Regular Expressions question on whitespace

  • Thread starter Thread starter bebop
  • Start date Start date
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]*)$");
 
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
 
Back
Top