From: Ammar Ali Date: 2010-11-21T23:20:04+09:00 Subject: Re: Problem regarding regular expression On Sun, Nov 21, 2010 at 4:11 PM, Stanford Ng wrote: > pal,i think i need more elaborate on these two expressions if possible. > /^[a-z]*/ > /[a-z]*$/ > please This might help. The following two expressions are matching the same thing: >> 'Well hello 123' =~ /^[a-z]*/ => 0 >> 'Well hello 123' =~ /^/ => 0 Same here: >> 'Well hello 123' =~ /[a-z]*$/ => 14 >> 'Well hello 123' =~ /$/ => 14 For more details, take a look at the matched data >> /^[a-z]*/.match('Well hello 123').to_a => [""] >> /[a-z]*$/.match('Well hello 123').to_a => [""] HTH, Ammar