7 Replies Latest reply: May 6, 2010 9:35 AM by 843789 RSS

    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");