I need some guidance on how to split a string with arithmetic operators and functions in java
for the example String is:
"string1"+"String2" >= 10 * function1() / function2()
operators may be:
+ - * / ** / % / ( ) = != > < <= >=
After Split
I need the output like:
array[0]=string1
array[1]=string2
array[2]=10
I need only things inside the double quotes and contants or numbers, not a functions(function1()) or operators.
I need regular expression for this problem
If you need a regex for extracting things inside the double quotes and numbers, then you can use this java code:
which outputs:
Note: I’m not sure that regex is the best tool in this case. As others suggested you may want to investigate the use of a parser.