?
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
Medium Priority
?
192 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

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 2000 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
We are witnesses that everyone is saying that our children shouldn't "play" with a technology because it is dangerous. This article is going to prove that they are wrong.
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…

762 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