From: Sebastian Hungerecker Date: 2008-10-10T18:12:15+09:00 Subject: Re: simple regexp help needed - pull phrase out of string Max Williams wrote: > >     irb(main):007:0> str.scan(/password:([^\s]+)/)[0] > >     => ["banana"] > > Aha, 'scan', that's great thanks. Yeah, though not really the most sensible in this case. Also you'd have to do [0][0] to acutally get "banana". I'd only use scan when you actually want multiple matches. Here I'd use match or String#[]: string[/password:(\S+)/, 1] => "banana" -- NP: Die Apokalyptischen Reiter - Der Weg Jabber: sepp2k@jabber.org ICQ: 205544826