I have to parse a Java String into 3 separate cases:
- If it has the form
"PREFIX(<signed_float>)=<Some_alpha_num_string>", I need to extract<signed_float>into one (Double) variable,<Some_alpha_num_string>into another (String) variable and ignore the rest. - Otherwise, if it has the form
"PREFIX=<Some_alpha_num_string>", I save<Some_alpha_num_string>and set theDoubleto some default (say0.0) - Otherwise I do nothing
So I guess the regex for #1 and #2 would be PREFIX[\(]?[-]?[0-9]*\.?[0-9]*[\)]?=\S*, but how do I use it to extract the two pieces?
BTW, I don't need to worry about the float being expressed in the scientific ("%e") notation
UPDATE: A bit of clarification: PREFIX is a fixed string. So examples of valid strings would be:
PREFIX=fOo1234bar-- here I need to extractfOo1234barPREFIX(-1.23456)=SomeString-- here I need to extract-1.23456andSomeStringPREFIX(0.20)=1A2b3C-- here I need to extract0.20and1A2b3C