clc wrote: > I've been using these two lines to capture text that only appears once, but > the second line bothers me a little. Is there a one-line idiom for this > that extracts groups like #scan but returns a string instead of an array so > the second line isn't needed? > > text = string.scan( %r{ skip_this ( keep_this ) skip_this }is ) > text = text[ 0 ] > > Thanks for any help, > Chris > text = string[/skip_this (keep_this) skip_this}is/, 1] and if you don't need the skip_this, text = string[/keep_this/] Yoann