Regular Expressions question on whitespace

B

bebop

Hi,

I have a Regular Expression that will match the format a
user provides in a textbox.

Ex. User types Brown,Joe in the textbox

I would like the expression to have both whitespace and
non-whitespace options after the comma.

bebop

Regex regex4 = new Regex("^[A-Z][a-zA-Z]*\\,+\\S+(|\\S)+
([a-zA-Z]*)$");
 
D

Dino Chiesa [Microsoft]

When I build Regex's , I use a visual tool like
- Regex Designer - by Chris Sells
http://www.gotdotnet.com/Community/Workspaces/Workspace.aspx?id=01e0dfb7-0182-45cd-94f7-2ed2df2504a9
check out this picture of the UI:
http://www.sellsbrothers.com/tools/index.1.jpg

- RegEx, by Gerry Shaw
http://www.organicbit.com/regex/fog0000000019.html


But still, the testing of all of the combinations of input is not easy with
this sort of visual tool. A generic regex test harness is useful.
http://www.winisp.net/cheeso/srcview.aspx?file=RegexVerifier.cs

-Dino
 

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

Top