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

Brandon Allbery allbery.b at gmail.com
Sat Jan 28 21:45:30 CET 2012


On Sat, Jan 28, 2012 at 15:26, Ilya Portnov <portnov at iportnov.ru> wrote:

> 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
>

regex-pcre is constrained by the common Haskell regex API (used by all the
regex-* packages), which doesn't support named captures.  Unfortunately, it
doesn't look like pcre-light will return the kind of capture alist you want
either; it uses the basic pcre_exec() function and doesn't appear to
provide an API for pcre_get_named_substring() etc.

dons doesn't seem to be very active any more (sandbagged by job?), so
pcre-light (which looks to be the obvious place for it given that
Text.Regex.PCRE.Base already provides a partial raw API) is likely open to
adoption; you could add the named capture API to T.R.P.Base and possibly
develop a more Haskell-like API later.

-- 
brandon s allbery                                      allbery.b at gmail.com
wandering unix systems administrator (available)     (412) 475-9364 vm/sms
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20120128/87f98ef6/attachment.htm>


More information about the Haskell-Cafe mailing list