Question Warriors Question Warriors - 1 year ago 85
Java Question

Conditionally splitting a string on a complex delimiter

I have string


I want output like this :



How can i achieve this using java
i mean to split with "," but "," which is after "|"

Answer Source

Add a positive lookbehind condition, for example:


Lookbehind condition (?<=\\|\\d{1,10}) means: | followed by up to 10 digits (as lookbehind requires defined maximum length, unbounded repetition modifiers as + or * cannot be used).