Don't use named capture groups for Ruby 1.8.7 compatibility

Fixes breakage in #2820