On Jan 29, 2007, at 1:28 PM, Gregory Seidman wrote: > On Tue, Jan 30, 2007 at 03:24:40AM +0900, Tom Pollard wrote: >> Does Ruby support regexps that assign names to specific matched >> groups? In Python, for instance, if you write a regexp like this, >> >> TEMP_RE = re.compile(r"""^(?P<temp>(M|-)?\d+|//|XX|MM)/ >> (?P<dewpt>(M|-)?\d+|//|XX|MM)?\s+""", >> re.VERBOSE) >> >> the match object will provide a hash with keys 'temp' and 'dewpt', > [...] > > Take a look at this thread: > http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/80270 Thanks very much for the quick response. It sounds like the answer is that Ruby does not support named captures, but that the Oniguruma library supplies this feature. I think it would be a nice feature to add in 1.9. My experience is this is very useful (if not necessary) for composing non-trivial regexps. Without them, it's just too easy to mess up the capture-group numbers when adding or removing parenthesized subexpressions in your regexp. Tom