Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 323
  • Last Modified:

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
0
bachra04
Asked:
bachra04
1 Solution
 
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
 
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
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.

Join & Write a Comment

Featured Post

The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now