I have a problem I can not solve. Let's say I have a variable that keeps the regExp pattern, that is to be provided by the user:
var pattern = this.state.regExpVal;
I also have a variable that keeps the value of textInput, meaning some piece of text, eg, postal codes.
var str = this.state.textAreaVal;
I create a new regExp object:
var myRegEx = new RegExp(pattern, 'g');
And the result is not ok:(it seems that the flag search globally is not working and I can not figure out why);
var result = str.match(myRegEx);
Can anyone help?