C#

Moderators: None (Apply to moderate this forum)
Number of threads: 2720
Number of posts: 5746

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Regular Expression Help Posted by DynamoCL on 29 May 2004 at 4:51 AM
Hi all,

Just started looking at regular expressions, and it appears that it could help in a problem that I used to spen ages working on.

I have a string for example:
"This [is] a word [document for windows] and it looks [very nice]"

What I want is to return the words in the square brackets. So the answer to the above (useless) string would be:

"is"
"document for windows"
"very nice"

I have tried a few examples, but they don;t work, what Regex should I use.


Thanks.
Report
Re: Regular Expression Help Posted by koticse on 25 Jun 2004 at 9:26 AM
Hi,

I don't know If I have understood your question correctly.

If you know what set of words are waste words, u can keep all those words in a string array and then compare each word of the given sentence with all of them and if found, then replace that word with spaces. I understood your question this way.

For example in Google search, it ommits all words like "is", "in", "for", ... I don't know if u trying to do the same. If it is the case, then above idea might help you.

All the best.



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.