I like to split a string into an array by using the split(regex) function.
I want to split it on semicolons ; – but there are also “escaped” semicolons in the String (\;) which should not be used for the split.
Is there a regex for the .split(regex) function that would do this?
Use
negative look-behindto split onsemi-colonnot preceded by\\: –You need to use
4 backslashes– escape a backslash once for Java, and then escape the 2 backslashes again for regex.