[erlang-questions] Adoption of perl/javascript-style regexp syntax
Tony Arcieri
tony@REDACTED
Wed Jun 3 08:00:05 CEST 2009
On Tue, Jun 2, 2009 at 11:03 PM, Richard O'Keefe <ok@REDACTED> wrote:
> It would be nice to tag the matches one wants with atoms rather
> than invisible integers.
I've thought about combining pattern matching with named capture groups,
ala:
/(?<a>f.o)(?<b>b.r)(?<c>b.z)/ = "foobarbaz"
would bind:
a: "foo"
b: "bar"
c: "baz"
If nothing else, I could support the Ruby 1.9 syntax:
>> "foobarbaz".match(/(?<a>f.o)(?<b>b.r)(?<c>b.z)/)[:b]
=> "bar"
--
Tony Arcieri
medioh.com
More information about the erlang-questions
mailing list