I'm learning Regular Expressions.
I'm trying to find the best way of writing an expression that extracts a number from within the parenthesis that follows the character R" so:
Example 1:
String("257*5.6+48.9/2*R(64)")
reg ex would return the numeric value inside R() in this case 64.
Example 2:
String("sin(45)*55 + X^2+R(-64.525)")
reg ex would return the numeric value inside R() in this case -64.525
My expression so far is:
/R\(\-?\d+\.?\d+\)/g
which returns R(number) taking into account possible decimal places and negative values.
Is there a better regular expression to match(return) only the number from inside the parenthesis that follows the character R?
Many thanks in advance for advice / help.
D