[Haskell-cafe] Embedding Perl RegEx in Haskell

Brandon Allbery allbery.b at gmail.com
Sun Aug 21 07:40:16 CEST 2011

On Sun, Aug 21, 2011 at 00:45, C K Kashyap <ckkashyap at gmail.com> wrote:

>> Why not just go with anchorHead and anchorTail or similar?  And a capture
>> could simply be
> Thanks for your inputs Brandon. I've updated the code with anchors. Still
> trying to get a hold of captures.

What are you finding difficult about them?  Backreferences?  Given that this
is Haskell, I'd look for ways to "tie the knot", although in terms of
usability it's probably best to maintain a list of captures where the knot
is actually tied between a capture regex component and its captures list
entry, with backreferences either also tying the knot with the captures list
or containing an offset in that list.  Practical usage:  you need to be able
to access the strings matched by captures from "outside", so you want an
independent structure for those captures rather than having to gmap the
regex tree to get the captured strings.

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/20110821/ab6b2307/attachment.htm>

More information about the Haskell-Cafe mailing list