From: Assaph Mehr Date: 2005-03-17T14:09:46+09:00 Subject: Re: regex question > line = "some line of stuff" > line =~ /regex stuff here/ > if $1; result = $1; end > > Generally, I'm checking to see if a given regex exists in a string and > I usually want to save some stuff from it. > > But my way seems kinda clunky... I like this way: .. if md = line.match(regex) # assign expr result in if .. puts md.captures .. end HTH, Assaph