I thought the /g was used to specify to keep searching for substrings after the first match?
I need to match all * + and - chars in a string.
(So I can parse the field names out and add them together).
This is my code, that doesn't work.
Thanks,
- J
I need to match all * + and - chars in a string.
(So I can parse the field names out and add them together).
This is my code, that doesn't work.
Code:
//this would eventually add the values of form fields
//Text1 and Text2
var strSum = 'Text1+Text2'
var oRE = new RegExp('(\+)|(\-)|(\*)|(k)/g');
var arr = oRE.exec(strSum);
alert('arr: ' + arr);
- J