regular expression handling apostrophe

Hi Experts,

I went to the following link and tried to modify the rgeular expression so it accepts the apostrophe but couldnt,



I need your help to solve this problem.

Please post the working solution.

Thanks
LVL 2
bachra04Asked:
Who is Participating?
 
Derek JensenCommented:
http://jsfiddle.net/CsQn7/98/ returns true for an apostrophe using this line:

var r = new RegExp("^['a-zA-Z0-9\*]\\\]\*$");

Open in new window

0
 
bachra04Author Commented:
Sorry here is the link:

http://jsfiddle.net/CsQn7/98/
0
 
Dan CraciunIT ConsultantCommented:
var r = new RegExp('^[\'a-zA-Z0-9\\*]\\\\]\\*$');

HTH,
Dan
0
 
bachra04Author Commented:
I don't know why right now the test is giving me false for any value I enter.

http://jsfiddle.net/CsQn7/98/
0
 
Terry WoodsIT GuruCommented:
It gives true for the value:
f\]*

Open in new window

Did you want to match a literal backslash character?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.