Skip to content

Tag: regex

How to properly split on a non escaped delimiter?

I have the following example string: with | being the delimiter and being the escape character. A proper split should look as follows: Also I need this logic to be generally applicable in case the delimiter or the escape consists out of multiple characters. I already have a regex which splits at the correct …

Java Pattern and Matcher no result

i’m writing this Java program for fun and i’m trying to get groups of substring with a regex. My string is read from a file and it’s something like: t<firstName type=”String”>John</firstName> where t is a tab. I wrote this code to isolate the needed substring, but whi…