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

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??
pinky1307Asked:
Who is Participating?
 
ozoConnect With a Mentor Commented:
you may need to use "\\" to pass a literal \ in ""
0
 
ozoCommented:
what expression do you write?
0
 
pinky1307Author Commented:
"^[+-]?\d+(\.\d+)?$"
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
pinky1307Author Commented:
Thanks for the reply. for integer or float values and for integer or decimal values. it takes "." and "\" as escape sequences
0
 
pinky1307Author Commented:
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
 
pinky1307Author Commented:
Thank you.
0
All Courses

From novice to tech pro — start learning today.