Solved

regular expression handling apostrophe

Posted on 2014-04-15
7
280 Views
Last Modified: 2014-06-01
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
Comment
Question by:bachra04
7 Comments
 
LVL 2

Author Comment

by:bachra04
ID: 40003136
Sorry here is the link:

http://jsfiddle.net/CsQn7/98/
0
 
LVL 34

Expert Comment

by:Dan Craciun
ID: 40003149
var r = new RegExp('^[\'a-zA-Z0-9\\*]\\\\]\\*$');

HTH,
Dan
0
 
LVL 2

Author Comment

by:bachra04
ID: 40004113
I don't know why right now the test is giving me false for any value I enter.

http://jsfiddle.net/CsQn7/98/
0
 
LVL 35

Expert Comment

by:Terry Woods
ID: 40005196
It gives true for the value:
f\]*

Open in new window

Did you want to match a literal backslash character?
0
 
LVL 9

Accepted Solution

by:
Derek Jensen earned 500 total points
ID: 40007049
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

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
The viewer will learn how to count occurrences of each item in an array.
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now