[{Action=GoTo, Title=0001000a, Page=1 XYZ 7 797 null}, {Action=GoTo, Title=0001000b, Page=3 XYZ 7 797 null}, {Action=GoTo, Title=0001000c, Page=5 XYZ 7 797 null}, {Action=GoTo, Title=0001000d, Page=7 XYZ 7 797 null}]
I'm trying to find the simplest way to parse the above String, all I need are "Title" and "Page". So I want a simple String[] = {"0001000a","1","0001000b","3"...}
str.split("(\\[|, )\\{Action=GoTo, Title=|, Page=| XYZ \\d+ \\d+ null\\}");
I have tested the regexp in a few online js regexp tester, it seems fine, but the resulting String[] = {"0001000a","1","","0001000b","3",""...}, an extra empty string after each page value.
str.split("\\[|\\{Action=GoTo, Title=|, Page=| XYZ \\d+ \\d+ null\\}(, |\\])");
This one produces String[] = {"","0001000a","1","","0001000b","3"...}, an empty string in front of every title value.
It seems like java doesn't like ", " as regexp, or it could be the way that Java String.split() works!?