mtch.names â [name1, name2, ...]
Instance Public methods
Returns a list of names of captures as an array of strings. It is same as mtch.regexp.names.
1 2 3 4 5 | /(?<foo>.)(?<bar>.)(?<baz>.)/.match( "hoge" ).names #=> ["foo", "bar", "baz"] m = /(?<x>.)(?<y>.)?/.match( "a" ) #=> #<MatchData "a" x:"a" y:nil> m.names #=> ["x", "y"] |
Please login to continue.