473,406 Members | 2,220 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,406 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 1341
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.