Solved

regular expression handling apostrophe

Posted on 2014-04-15
7
292 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 2

Author Comment

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

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

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

710 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