From: Gunther Diemant Date: 2011-03-25T08:27:15+09:00 Subject: Re: Regexp, matching only the content within parentheses --e0cb4e38553441e25d049f42cf6f Content-Type: text/plain; charset=ISO-8859-1 I think /\(([^)]+)\)/ should work. For your example string: "d_(1)+d_(23)".scan(/\(([^)]+)\)/) #=> [["1"],["23"]] -- gunther 2011/3/24 Emil Kampp > Hi. > > I'm hoping that someone can give me some pointers. I need to match the > content within the parentheses only, from the following string (this is > an example string, but the structure is consistent): > > d_(1)+d_(23) > > So far I have matched something else using \b to match a closing tic > (`), but that doesn't seem to work here: > > \_\((.+)\b[^)] > > Best regards > // Emil > > -- > Posted via http://www.ruby-forum.com/. > > --e0cb4e38553441e25d049f42cf6f--