473,326 Members | 2,337 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Regular Expressions question on whitespace

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]*)$");
Jul 21 '05 #1
2 1338
Just off the top of my head:

Regex myreg = new Regex(@"^[A-Z][\w]*\,[\s|\w](\w*)$");

Hope that helps.

Cheers,
Wim Hollebrandse
http://www.wimdows.net
http://www.wimdows.com

---
Posted using Wimdows.net Newsgroups - http://www.wimdows.net/newsgroups/
Jul 21 '05 #2
When I build Regex's , I use a visual tool like
- Regex Designer - by Chris Sells
http://www.gotdotnet.com/Community/W...7-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...gexVerifier.cs

-Dino

"Wim Hollebrandse" <wim@-NOSPAM-wimdows.net> wrote in message
news:uM*************@TK2MSFTNGP10.phx.gbl...
Just off the top of my head:

Regex myreg = new Regex(@"^[A-Z][\w]*\,[\s|\w](\w*)$");

Hope that helps.

Cheers,
Wim Hollebrandse
http://www.wimdows.net
http://www.wimdows.com

---
Posted using Wimdows.net Newsgroups - http://www.wimdows.net/newsgroups/

Jul 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: hu8 | last post by:
I must find a regular expression to find every declaration af a variable in a php programm..... I tried: /\$()*(\s|\S)\=(\s|\S)/is But it doesn't reall go :-(
5
by: Andrew Dixon - Depictions.net | last post by:
Hi Everyone. I have been working on some code that strips the HTML code out of an HTML page leaving just the text on the page. At the moment this is what I have: // Strip all tags...
1
by: Kenneth McDonald | last post by:
I'm working on the 0.8 release of my 'rex' module, and would appreciate feedback, suggestions, and criticism as I work towards finalizing the API and feature sets. rex is a module intended to make...
11
by: Martin Robins | last post by:
I am trying to parse a string that is similar in form to an OLEDB connection string using regular expressions; in principle it is working, but certain character combinations in the string being...
6
by: Marc Scheuner [MVP ADSI] | last post by:
Folks, I've started using regular expressions for parsing some data string that come along - works quite nicely, however, as a newbie to RE, I'm still struggling with some special cases: 1) I...
1
by: | last post by:
Hi, I have a Regular Expression that will match the format a user provides in a textbox. Ex. Brown,Joe in the textbox I would like the expression to have both whitespace and...
1
by: Scott Schluer | last post by:
Hi all, I got a JavaScript function from a website that uses regular expressions to count the number of words in a textbox. I'm trying to replicate it with ASP.NET so I can run a second check on...
9
by: Pete Davis | last post by:
I'm using regular expressions to extract some data and some links from some web pages. I download the page and then I want to get a list of certain links. For building regular expressions, I use...
8
by: Damo | last post by:
Hi, I'm new to this group and regular expressions. I want to extract text from a newspaper website using regular expressions and php I'm using this regular expression at the moment $regexp =...
2
by: John Nagle | last post by:
Regular expressions are compiled in ASCII mode unless Unicode mode is specified to "rc.compile". The difference is that regular expressions in ASCII mode don't recognize things like Unicode...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.