7 Replies Latest reply on May 6, 2010 2:35 PM by 843789

    regular expressions, characters unallowed in file names

      trying to take a url and turn it into a file name by grabbing the last bit of the string that doesnt have any characters that arent allowed in file names, but this keeps returning the same sting over and over again "://"
      System.out.println("\n" + filename + "\n");
      Pattern pattern = Pattern.compile("[\\\\/:\\*\\?\\\"<>\\|][^[\\\\/:\\*\\?\\\"<>\\|]]+");
      Matcher matcher = pattern.matcher(filename);
      while (matcher.find())
      filename = matcher.group();
      System.out.println("\n" + filename + "\n");