From: William James Date: 2005-08-12T13:41:10+09:00 Subject: Re: Regular Expression question Florian Gro� wrote: > tuyet.ctn@mscibarra.com wrote: > > > How do I extract CYZ-EdEi8QBzG2f3m7prHw99 from the sessionId text > > below. [...] > > > > neae/Analysis/home?common.sessionId=CYZ-EdEi8QBzG2f3m7prHw99" > > Others suggested more complex ways, but String#[] can take a capture > counter with Regexps: > > sid = input[/sessionId=([-\w]+)/, 1] Some may find this surprising: puts input.split(/sessionId=(.*?)"/)[1]