Solved

I am adding regular expressions dynamically. I have to write the validation expression in code behind. But when i add the expression, it says, invalid escape sequence. What can i do??

Posted on 2009-04-03
6
191 Views
Last Modified: 2012-05-06
I am adding regular expressions dynamically. I have to write the validation expression in code behind. But when i add the expression, it says, invalid escape sequence. What can i do??
0
Comment
Question by:pinky1307
[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
  • 4
  • 2
6 Comments
 
LVL 84

Expert Comment

by:ozo
ID: 24057429
what expression do you write?
0
 

Author Comment

by:pinky1307
ID: 24057435
"^[+-]?\d+(\.\d+)?$"
0
 

Author Comment

by:pinky1307
ID: 24057438
Thanks for the reply. for integer or float values and for integer or decimal values. it takes "." and "\" as escape sequences
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:pinky1307
ID: 24057447
RegularExpressionValidator rv = new RegularExpressionValidator();
                                rv.ID = rev;
                                rv.ControlToValidate = tb.ID;
                                rv.ErrorMessage = "Must be an integer ";
                                rv.Text = "*";
                                rv.ValidationExpression = ("^[+-]?\d+(\.\d+)?$");

this is the code i use.
0
 
LVL 84

Accepted Solution

by:
ozo earned 500 total points
ID: 24057556
you may need to use "\\" to pass a literal \ in ""
0
 

Author Comment

by:pinky1307
ID: 24057564
Thank you.
0

Featured Post

Enroll in June's Course of the Month

June's Course of the Month is now available! Every 10 seconds, a consumer gets hit with ransomware. Refresh your knowledge of ransomware best practices by enrolling in this month's complimentary course for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

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

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
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…

729 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