-
sign can be treated as operator or negative sign. If -
is located in the start, it shall be treated as the negative sign and a subtraction whiting the string. This is only apply to -
sign while the +
will be always the add sign. How can I achieve this?
input:
-23-23+4=F1Qa;
+23-23+4=F1Qa;
output:
["-23","-","23","+","4","=","F","1","Q","a",";"]
["+", "23","-","23","+","4","=","F","1","Q","a",";"]
This is what I've tried so far
String regx = (?:# .*? #:?)|(?!^)(?=\\D)|(?<=\\D)(?=\\d-)
String[] splits = inputString.split(regx);