I'm trying to match elements with a name that is 'container1$container2$chkChecked', using a regex of '.+\$chkChecked', but I'm not getting the matches I expect when the element name is as described. What am I doing wrong?
-
So what are you expecting and what are you getting?Sietse– Sietse2008-09-18 11:06:13 +00:00Commented Sep 18, 2008 at 11:06
Add a comment
|
5 Answers
my guess, by your use of quotes, is you did something like
re = new RegExp('.+\$chkChecked');
which won't work because js takes advantage of the \ in its string interpretation as an escape so it never makes it into the regex interpreter
instead you want
re = new RegExp('.+\\$chkChecked');
Comments
It looks like it should work.
There's a good Javascript Regex Tester that also says it matches.