[Haskell-cafe] Named captures in regex-pcre?

Ilya Portnov portnov at iportnov.ru
Sat Jan 28 21:26:29 CET 2012


Hi haskell-cafe.

Is there a way to get named captures from regex using regex-pcre (or 
maybe other PCRE-package)? For example, I want to write something like

let result = "ab 12 cd" =~ "ab (?P<number>\d+) cd" :: SomeCrypticType

and then have namedCaptures result == [("number", "12")].

I do not see somewhat similar in regex-pcre documentation. It parses 
such regexs fine, and captures work, but i do not see way to get _named_ 
captures.

WBR, Ilya Portnov.



More information about the Haskell-Cafe mailing list