Sandor Szücs
7/14/2008 12:14:00 PM
On 14.07.2008, at 09:38, Jayan Jacob wrote:
> When I use /^[0-1]{1}$/ with "1" as subject it works but
> /^[0-1]{1}[a-zA-Z]{1,25}$/ syntax for "1,abcd" , I have checked out on
> the interpreter directly both works fine. I suppose I am messing up
> something with the files, or gets or chomp or ..
>
> Any help ?
That RegEx: /^[0-1]{1}[a-zA-Z]{1,25}$/ doesn't match ','.
maybe: add ','
irb> regex2=3D/^[0-1]{1},[a-zA-Z]{1,25}$/
=3D> /^[0-1]{1},[a-zA-Z]{1,25}$/
irb> regex2.match "1,abcd"
=3D> #<MatchData "1,abcd">
or '.?'
irb> regex3=3D/^[0-1]{1}.?[a-zA-Z]{1,25}$/
=3D> /^[0-1]{1}.?[a-zA-Z]{1,25}$/
irb> regex3.match "1,abcd"
=3D> #<MatchData "1,abcd">
hth. regards, Sandor Sz=FCcs
--=