I have following string:
;Spe \,\:\; cial;;;
and I want to split it with semicolon as delimiter, however semicolon preceded by “\” should not be counted as delimiter. So I would like to get something like
["", "Spe \,\:\; cial", "", "", ""]
Update:
Java representation looks like:
String s = ";Spe \\,\\:\\; cial;;;";
Use a negative look-behind:
(Note that there’s really only a single
\in this expression — ie, the expression should be(?<!\);— but the backslash character has to be double-escaped: once for the benefit of the Java compiler, and again for the benefit of the regex engine.)