Link to home
Start Free TrialLog in
Avatar of John500
John500Flag for United States of America

asked on

How to interpret: "^\w+[\\]\w+$"

Greetings:

I'm trying to debug code written by another developer.  What happens is the user is prompted to enter a domain and user name in order to proceed.  The code looks like this:

s.Owner = InputBox.Show(InputBox.IOptions.O_Cancel, ..., @"^\w+[\\]\w+$", @" Enter domain\username");

I'm guessing that after the user clicks the 'OK' button, the domain and user name are processed via the regular expression.  If I were to enter the following, what should be expected?

MyDomain\JoeUser

Thanks!
Avatar of John500
John500
Flag of United States of America image

ASKER

Also, if I were to test this expression using the utility seen in the picture below, can anyone tell me what the correct steps are to test the expession?  I know I have to create the object, but then what?
Avatar of John500

ASKER

Forgot the file:
regular-expression.JPG
ASKER CERTIFIED SOLUTION
Avatar of Fernando Soto
Fernando Soto
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
In your post using Regular Expression Demo program you do not see a result because the input string is invalid.

"\MyDomain\JoeUser"

The very first character \ causes it to fail because it is not defined by \w as being a first character. The following would be correct:


"MyDomain\JoeUser"
Avatar of John500

ASKER

Fernando,

Thanks much for the detailed answer.

That's what I needed .... !
Not a problem, always glad to help.  ;=)