irb(main):008:0> m
=> /([a-z]{3})[02-9][0-9]{2}\1/
irb(main):009:0> a='xxx765xxx'
=> "xxx765xxx"
irb(main):010:0> b='vvv123vvv'
=> "vvv123vvv"
irb(main):011:0> a.match(m)
=> #<MatchData:0xb7dc0354>
irb(main):012:0> puts a.match(m)
xxx765xxx
=> nil
irb(main):013:0> puts b.match(m)
nil
=> nil

Jayanth

On Thu, Jul 3, 2008 at 3:41 PM, Srijayanth Sridhar <srijayanth / gmail.com> wrote:
> /([a-z]{3})[02-9][0-9]{2}\1/
>
> Should work.
>
> Jayanth
>
> On Thu, Jul 3, 2008 at 3:21 PM, shaman <noone / nowhere.com> wrote:
>> Hello-
>>
>> I need to match any string which contain:
>>
>> any 3 letters
>> any 3 digits _but_not_123_
>> any 3 letters
>>
>> so:
>> xxx765xxx should match
>> vvv123vvv should be omitted
>>
>> is it possible to write proper regular expression?
>>
>> Regards-
>> shaman
>>
>>
>