Forum Moderators: coopster

Message Too Old, No Replies

Regex Problem

         

rfontaine

12:14 pm on May 11, 2005 (gmt 0)

10+ Year Member



Hi,

I am trying to figure out a regular expression that matches any double letters in a word. For example,

Look (the double o's)
connect (the double n's)

I think it might be pretty simple but it is baffleing me.

Thank you in advance :-)

ergophobe

6:25 pm on May 11, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



You need to capture one letter and then chekc it with a backreference

([a-z])\1

does what you wantin GREP. You'll need to add some slashes or use the $ backref to do this in PHP, something like

([a-z])\\1

([a-z])$1