Looking for a regular expression

  • Thread starter Thread starter Stephen Wood
  • Start date Start date
S

Stephen Wood

This is a variation on the repeated word problem.

I am trying -- thus far without success -- to craft a regular expression to
detect repeated words. However, in this expression, I need to allow for an
optional comma and space between the repeated words and to capture the
repeated word in a backreference.

Any regex junkies out there know how to do this?

Thanks,

Stephen
 
Thanks, Brian.

What I'm looking for is something that, given the following input text --

"bells, bells"

-- or --

"bells bells"

would detect the word repetition in both cases.

I tried the expression you supplied, and it does the trick.

Thanks,

Stephen
 
Back
Top