Help on Regular Expreission syntax

G

Guest

Dear all,

I have a text box on which my user should enter a server name in the form of
"\\MyServer" . I have place on my form a RequireFiledValidator and a
RegularExpressionValidator.

What is the syntax of the Expression to check that the starting charcter for
the textbox is \\ ?

I have tryied "^\\\" but it is nor correct

thnaks for your help

regards
serge
 
H

Hans Kesting

serge said:
Dear all,

I have a text box on which my user should enter a server name in the
form of "\\MyServer" . I have place on my form a
RequireFiledValidator and a RegularExpressionValidator.

What is the syntax of the Expression to check that the starting
charcter for the textbox is \\ ?

I have tryied "^\\\" but it is nor correct

thnaks for your help

regards
serge

You should escape both "\"'s, so you will end up with four of them : \\\\
I have the impression that the REvalidator acts as if it always prepends
a ^ and appends a $ to the RE, so the entire input must match the entire RE.
In this case you want to start with \\, but after that "anything" is possible.
Try "\\ \\ .*" (without the spaces, which were added for clarity).
You could also use "\\ \\ [a-zA-Z] [a-zA-Z0-9]*", to force at least one letter
and after that any number of letters and/or numbers - no other characters allowed.

Hans Kesting
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,140
Latest member
SweetcalmCBDreview
Top