I\'d like to parse a string so I can build an XML document.
I have:
String value = \"path=/Some/Xpath/Here\";
I\'ve parsed it this way
Just do replace before splitting.
String[] tokens = s.replaceFirst(".*=", "").split("/");
This would give you an empty element at first because it would do splitting on the first forward slash after replacing.
or
String[] tokens = s.replaceFirst(".*=/", "").split("/");
But if you remove all the chars upto the =
along with the first forward slash will give you the desired output.