From: tho_mica_l Date: 2007-10-09T16:30:05+09:00 Subject: Re: regexp question - look for parentheses then remove them > ah, "captures" You can access the match data right away: x = /\((.*)\)/.match("3 * (1 + 2)") x[1] or $1 I'd also make the * non-greedy -> *? /\((.*?)\)/.match("3 * (1 + 2) * (3 + 4)")[1] => "1 + 2" but: /\((.*)\)/.match("3 * (1 + 2) * (3 + 4)")[1] => "1 + 2) * (3 + 4"