From: Warren Brown Date: 2004-09-23T04:15:47+09:00 Subject: Re: Regexp Arity T., > Just ran into a need to know how many parenthetical > groupings a Regexp has. Would #arity for Regexp be > a good idea? Just to state the obvious, re.source.count('(') would work if you can guarantee there are no literal left parenthesis ("\(") in the regular expression. If you can't guarantee that, you could always count them and subtract from the total, but that would be messy. Perhaps we could use Regexp#length to mirror MatchData#length. - Warren Brown