Regular Expression

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm trying to verify that a string conforms to the standard:

DomainName\Username

Domain and User can be letters and numbers (nothing else). I've played
around with this, but my expression returns a match if there is more than one
'\'

Example: dom\ain\Administrator (should not return a match, but does)

Thanks,
Mark
 
Mark said:
I'm trying to verify that a string conforms to the standard:

DomainName\Username

Domain and User can be letters and numbers (nothing else). I've played
around with this, but my expression returns a match if there is more than
one
'\'

Example: dom\ain\Administrator (should not return a match, but does)

Hi Mark,

I found this utility very useful when trying to understand and construct
regular expressions:

http://www.regular-expressions.info/regexbuddy.html
 
Mark said:
I'm trying to verify that a string conforms to the standard:

DomainName\Username

Domain and User can be letters and numbers (nothing else). I've played
around with this, but my expression returns a match if there is more than one
'\'

Example: dom\ain\Administrator (should not return a match, but does)

Thanks,
Mark

It would help if you showed the expression you're using, so we could
possibly explain why it's not working, but you could try this:

[0-9A-Za-z]+\\[0-9A-Za-z]+

Adam Ruth
 
Back
Top