Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / .NET SDK / October 2004

Tip: Looking for answers? Try searching our database.

Need a specific Regular Expression

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Corey Snow - 12 Oct 2004 17:55 GMT
Hi all. I'm trying to craft a regular expression to help me tokenize a string
containing mixed content. The string would be something like:

foo "bar baz" fuz

or another variant thereof. What I'm trying to accomplish is to use a RegEx
and get the following out of the above string:

foo
bar baz
fuz

However, I can't seem to figure out what I should use as a regular
expression to acheive the desired result. I'm also thinking that it might not
be possible to do this easily with a regex, in which case I'll just fall back
to manually breaking up the string. However, any insight would be appreciated.

Thanks!

Corey Snow
Niki Estner - 12 Oct 2004 22:52 GMT
> Hi all. I'm trying to craft a regular expression to help me tokenize a
> string
[quoted text clipped - 17 lines]
> to manually breaking up the string. However, any insight would be
> appreciated.

Will this expression work?
("[^"]*")|(\w*)

It seems to do so in Expresso.

Niki
Corey Snow - 12 Oct 2004 23:49 GMT
> > Hi all. I'm trying to craft a regular expression to help me tokenize a
> > string
[quoted text clipped - 24 lines]
>
> Niki

The expression ("[^"]*")|(\s*) does seem to work- with the "\w", it leaves
out any tokens outside the quotation marks.

Thanks!
Niki Estner - 14 Oct 2004 13:03 GMT
>> > Hi all. I'm trying to craft a regular expression to help me tokenize a
>> > string
[quoted text clipped - 29 lines]
> The expression ("[^"]*")|(\s*) does seem to work- with the "\w", it leaves
> out any tokens outside the quotation marks.

You must be using Regex.Match wrong then...
Matching for "\s" will only match for the spaces between words.

Niki

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.