Delete double words with regular expression 
Author Message
 Delete double words with regular expression

I have a string like this:
"This is a normal normal string. But there are are some words that are
superfluos."

My goal is to delete these superfluos words that the string looks like this:
"This is a normal string. But there are some words that are superfluos."

I think the easiest way is doing it with regular expression, but how...?

Thanks for your help!
Dave



Wed, 06 Oct 2004 04:09:08 GMT  
 Delete double words with regular expression
Regex.Replace("This is a normal normal string. But there are are some words that are

HTH,
--
Yizhaq Shmaayahoo
Quote:

> I have a string like this:
> "This is a normal normal string. But there are are some words that are
> superfluos."

> My goal is to delete these superfluos words that the string looks like this:
> "This is a normal string. But there are some words that are superfluos."

> I think the easiest way is doing it with regular expression, but how...?

> Thanks for your help!
> Dave



Wed, 06 Oct 2004 05:54:05 GMT  
 Delete double words with regular expression
Thanks for that, but there's an other problem, how do I handle this with a
string where the word appears three or five times (not only twice)

("This is is is is a very stupid string")

What's the Regular expression, that matches for this problem?



Quote:
> Regex.Replace("This is a normal normal string. But there are are some
words that are

> HTH,
> --
> Yizhaq Shmaayahoo



Quote:
> > I have a string like this:
> > "This is a normal normal string. But there are are some words that are
> > superfluos."

> > My goal is to delete these superfluos words that the string looks like
this:
> > "This is a normal string. But there are some words that are superfluos."

> > I think the easiest way is doing it with regular expression, but how...?

> > Thanks for your help!
> > Dave



Wed, 06 Oct 2004 05:30:44 GMT  
 Delete double words with regular expression
Regex.Replace("This is is is a normal normal string. But there are are are some words that are

(just add + after \1)
--
Yizhaq Shmaayahoo
Quote:

> Thanks for that, but there's an other problem, how do I handle this with a
> string where the word appears three or five times (not only twice)

> ("This is is is is a very stupid string")

> What's the Regular expression, that matches for this problem?



> > Regex.Replace("This is a normal normal string. But there are are some
> words that are

> > HTH,
> > --
> > Yizhaq Shmaayahoo


> > > I have a string like this:
> > > "This is a normal normal string. But there are are some words that are
> > > superfluos."

> > > My goal is to delete these superfluos words that the string looks like
> this:
> > > "This is a normal string. But there are some words that are superfluos."

> > > I think the easiest way is doing it with regular expression, but how...?

> > > Thanks for your help!
> > > Dave



Wed, 06 Oct 2004 06:40:03 GMT  
 Delete double words with regular expression
Wow! Thanks a lot. I think I begin to grasp these things...


Wed, 06 Oct 2004 06:23:03 GMT  
 Delete double words with regular expression
How about a spell checker to go with that?  *chuckles*
Just ribbing you, but the word is "superfluous".


Quote:
> I have a string like this:
> "This is a normal normal string. But there are are some words that are
> superfluos."

> My goal is to delete these superfluos words that the string looks like
this:
> "This is a normal string. But there are some words that are superfluos."

> I think the easiest way is doing it with regular expression, but how...?

> Thanks for your help!
> Dave



Wed, 06 Oct 2004 21:17:41 GMT  
 Delete double words with regular expression



Quote:
> How about a spell checker to go with that?  *chuckles*

Because the text I have is a text generated by random characters and
probability for combinations of the letters, so there are no real words and
a spell checker wouldn't work...
Quote:
> Just ribbing you, but the word is "superfluous"



> > I have a string like this:
> > "This is a normal normal string. But there are are some words that are
> > superfluos."

> > My goal is to delete these superfluos words that the string looks like
> this:
> > "This is a normal string. But there are some words that are superfluos."

> > I think the easiest way is doing it with regular expression, but how...?

> > Thanks for your help!
> > Dave



Thu, 07 Oct 2004 07:13:32 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. Regular expression with double quotes

2. regular expressions expression with space and then multiple spaces

3. Wildcard Expressions (single regular expressions)

4. Reading from text file / regular expression

5. Help with Regular Expressions

6. How to use Regular Expression to parse this?

7. CharTraits in regular expressions

8. regular expressions

9. Regular Expression Question

10. regular expression for csv string

11. Regular Expressions

12. Regular Expressions

 

 
Powered by phpBB® Forum Software