From: "ToMaTo@..." Date: 2011-11-22T07:27:37+09:00 Subject: Re: Regular expression match --0015174c14da7a1aa604b246311d Content-Type: text/plain; charset=ISO-8859-1 Hello, This syntax is used to return the matching portion of supplied regxp. For example: "hello world"[/(\w+)(\s)(\w+)/, 0] #=> "hello world" "hello world"[/(\w+)(\s)(\w+)/, 1] #=> "hello" "hello world"[/(\w+)(\s)(\w+)/, 2] #=> " " "hello world"[/(\w+)(\s)(\w+)/, 3] #=> "world" On Mon, Nov 21, 2011 at 5:02 PM, rubix Rubix wrote: > Hi, > > Can anyone explain to me this regular expression, please: > str[/\A([a-z]\w*)/, 1] > > what's the use of 1 in this expression > regards, > > -- > Posted via http://www.ruby-forum.com/. > > -- Life is a miracle. --0015174c14da7a1aa604b246311d--