Skip to main content

regular expressions, characters unallowed in file names

No replies
Joined: 2010-05-01
Points: 0

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 "://"

<br />
System.out.println("\n" + filename + "\n");<br />
Pattern pattern = Pattern.compile("[\\\\/:\\*\\?\\\"<>\\|][^[\\\\/:\\*\\?\\\"<>\\|]]+");<br />
Matcher matcher = pattern.matcher(filename[i]);<br />
while (matcher.find())<br />
{<br />
  filename =;<br />
  System.out.println("\n" + filename + "\n");<br />

Message was edited by: chopficaro