On Sun, Nov 21, 2010 at 4:11 PM, Stanford Ng <ngkooinam / gmail.com> 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