L
Lord Khaos
If I am trying to find an expression, foo, I can do something like
this:
rExp = /foo/gi;
if(results.search(rExp) > -1){
and all work fine.
however, if I want my search term to be a variable, bar:
var bar= "foo";
i get error when I try to concatinate bar into the regex.
I'm not very good with Regular expressions, or JavaScript for that
matter, but apparently rExp is not a string or it would be in quotes,
and it isn't an integer or boolean. So what is it's data type? and how
would I merge the variable bar into it so that it is /bar/gi?
Thanks,
L^K
this:
rExp = /foo/gi;
if(results.search(rExp) > -1){
and all work fine.
however, if I want my search term to be a variable, bar:
var bar= "foo";
i get error when I try to concatinate bar into the regex.
I'm not very good with Regular expressions, or JavaScript for that
matter, but apparently rExp is not a string or it would be in quotes,
and it isn't an integer or boolean. So what is it's data type? and how
would I merge the variable bar into it so that it is /bar/gi?
Thanks,
L^K