From: "David A. Black" Date: 2008-07-03T19:52:14+09:00 Subject: Re: yet another regexp problem --1926193751-839390554-1215082522=:5982 Content-Type: MULTIPART/MIXED; BOUNDARY="1926193751-839390554-1215082522=:5982" This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --1926193751-839390554-1215082522=:5982 Content-Type: TEXT/PLAIN; charset=X-UNKNOWN; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE Hi -- On Thu, 3 Jul 2008, Benjamin Billian wrote: > On 3 Jul., 12:22, shaman wrote: >> Srijayanth Sridhar pisze: >> >> =A0> /([a-z]{3})[02-9][0-9]{2}\1/ >> =A0> >> =A0> Should work. >> >> it's not so easy because "vvv133vvv" also should match but your >> expression return nil :( > > The following Expression worked for me: > /[a-z]{3}(?:(?:[^1]\d{2})|(?:1[^2]\d)|(?:12[^3]))[a-z]{3}/ You can just use negative lookahead: (?!123) David --=20 Rails training from David A. Black and Ruby Power and Light: Intro to Ruby on Rails July 21-24 Edison, NJ Advancing With Rails August 18-21 Edison, NJ See http://www.rubypal.com for details and updates! --1926193751-839390554-1215082522=:5982-- --1926193751-839390554-1215082522=:5982--