N
Nick
Hi,
How can I check if a number exists by itself in this string by using
the RegExp object?
---
var mystring = "11,111,01,011";
var match = "1";
var re = new RegExp( match );
var isFound = re.test( mystring ) );
---
Running this code returns 'true' which is not what I want since number
one doesn't exist by itself. I need to use the "match" variable since
it will change depending on user input.
I can only get it to work without variables in the expression. E.g.
var re = new RegExp( /\b1\b/ );
Many thanks
How can I check if a number exists by itself in this string by using
the RegExp object?
---
var mystring = "11,111,01,011";
var match = "1";
var re = new RegExp( match );
var isFound = re.test( mystring ) );
---
Running this code returns 'true' which is not what I want since number
one doesn't exist by itself. I need to use the "match" variable since
it will change depending on user input.
I can only get it to work without variables in the expression. E.g.
var re = new RegExp( /\b1\b/ );
Many thanks