Im trying to implement a regex for my game, my target is to read a file, and get relative links (they look like this : C:\windows\blah\blah)
and i want to replace all of the " \ " with " / " so it looks like (C://windows/blah/blah)
the problem i run into is java is throwing this nasty error:
java.util.regex.PatternSyntaxException: Unexpected internal error near index 1
\
^
at java.util.regex.Pattern.error(Unknown Source)
at java.util.regex.Pattern.compile(Unknown Source)
at java.util.regex.Pattern.<init>(Unknown Source)
blah blah
so, obviously it doesntl ike my regex code, here it is
for(int i=0;i<fileLines.size();i++){
String tmp = (String)fileLines.get(i); //file lines is an arraylist of strings
//which is relative to the lins of the file
String one = "\\";
char o = 92;
System.out.println((int)'\\');
System.out.println(one+"HELLOWORLD");
System.out.println("TTTTTTTTTTTTTTTTTTTTTTTT"+tmp);
tmp.replaceAll(""+o, "/");
System.out.println("TTTTTTTTTTTTTTTTTTTTTTTT"+tmp);
//tmp.replaceAll("\\", "\\"+"\\");
fileLines.set(i, tmp);
}
can anyone tell me what im doig wrong and how to fix it?