From: Sylvester Keil Date: 2011-11-22T07:30:44+09:00 Subject: Re: Regular expression match On Nov 21, 2011, at 11:02 PM, rubix Rubix wrote: > Hi, > > Can anyone explain to me this regular expression, please: > str[/\A([a-z]\w*)/, 1] Check out the documentation: ri String#[] When given a regular expression and a fixnum, you're matching the string against the regular expression and returning the capturing group indicated by the fixnum. That is to say, your example will match a word beginning with a lower case letter at the beginning of the string. Since \A is an anchor and therefore not part of the matched string and if I am not mistaken, your expression is actually equivalent to just str[/\A[a-z]\w*/] If there is a particular reason for using the capturing group over the entire expression there you should probably add a comment to document it! Sylvester