I read from file like this:
List<String> list = Files.readAllLines(Paths.get("file.csv"));
After that I try to call replaceAll
method on every string in the list, but it doesn't work with any regex and replacement string. Although, when I apply replaceAll
with the same arguments to a string that I assign in code, it works fine.
The strings look like this: "Hello","World","!!!"
Edit:
List<String> res = Files.readAllLines(Paths.get("TimeTable.csv"));
String p = "^\"(\\w+) (\\w+) (\\w+) (?:.+)?\",\"(\\d+)\\.(\\d+)\\.(\\d+)\",\"(\\d+):(\\d+):(\\d+)\"(?:.*?)$/i";
String rep = "$6-$5-$4 ==> $7:$8 $1 $2 $3";
String s = res.get(1).replaceAll(p, rep);
System.out.print(s);
The file consists of strings like that:
"AK Pz 310u PI-13-5","23.02.2015","07:45:00","23.02.2015","09:20:00","False","True","23.02.2015","07:40:00","2","Common","AK Pz 310u PI-13-5","Common"
Here is the exact code I'm using: http://pastebin.com/GhhrRWAU
And here is the file I'm trying to parse: http://www.fileconvoy.com/dfl.php?id=g450e5a3e83854bdc999643999f2ceb8c622d6abf2