G
graphicsxp
Hi,
I use eval to convert a string to a regular expression and I use exec
to find whether a string matches the regexp or not:
eval("/(\\d)+(\\.)+(\\d)/").exec("1.3")
should return an array, prooving it is matching.
This method works really well with all the regular expression I've
worked with so far. But not with the one above !
In fact it's very strange because if I do :
var myRegExprString = "/(\\d)+(\\.)+(\\d)/";
eval(myRegExprString).exec("1.3")
This returns null. However if I do :
eval("/(\\d)+(\\.)+(\\d)/").exec("1.3")
that returns an array ! I can't see the difference between passing a
string variable or just a string.... Besides it only occurs with this
particular regexpr, not with others !
Can someone help ?
Thanks
I use eval to convert a string to a regular expression and I use exec
to find whether a string matches the regexp or not:
eval("/(\\d)+(\\.)+(\\d)/").exec("1.3")
should return an array, prooving it is matching.
This method works really well with all the regular expression I've
worked with so far. But not with the one above !
In fact it's very strange because if I do :
var myRegExprString = "/(\\d)+(\\.)+(\\d)/";
eval(myRegExprString).exec("1.3")
This returns null. However if I do :
eval("/(\\d)+(\\.)+(\\d)/").exec("1.3")
that returns an array ! I can't see the difference between passing a
string variable or just a string.... Besides it only occurs with this
particular regexpr, not with others !
Can someone help ?
Thanks