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
190 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
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 

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

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

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

This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
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…

738 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