I am trying to write a regex that will split the string when there is a space followed by a negative sign followed by an insecure one.
Example:
"x -y".split(regex)
returns: String[]{"x","-y"};
I am currently using
(?<=\\s)-(?=\\S+)
for my regular expression; but it returns "x", "y" and eats a negative sign. Is there a way to not have a negative sign?
Thank!
djs22 source
share