From: Maurice Szmurlo Date: 2000-12-21T03:31:23+09:00 Subject: [ruby-talk:7783] Re: Regex array subscripts meaning /\d/ -> one digit /\d+/ -> more than one digit indexes of caracters in a string 1 01234567890 "one 123 two" > /\d/ =~ s -> what is the position of a digit (the first one) > /\d+/ =~ s -> --- " --- more than one digit > s[/\d/] -> caracter in s corresponding to the position of the first digit > s[/\d+/] -> caracters (the larger possible string) correspondint ... etc maurice craig duncan wrote: > > Can someone explain why this is the case: > > s="one 123 two" => "one 123 two" > /\d/ =~ s => 4 > /\d+/ =~ s => 4 > s[/\d/] => "1" > s[/\d+/] => "123" > > I like it, but i can't find any explanation of what // returns > that would explain it.