Despite the ridiculously large number of regex matching engines for Haskell, the only one I can find that will substitute is Text.Regex
, which, while decent, is missing a few thing I like from pcre. Are there any pcre-based packages which will do substitution, or am I stuck with this?
views:
283answers:
2
+2
A:
Point out glaring mistakes, things that are obviously wrong, et cetera.
sreservoir
2010-10-03 14:45:17
Nice! Once you get some feedback and get it into shape, maybe consider sending it as a patch to regex-lite, or failing that, placing it on hackage on its own?
sclv
2010-10-03 17:42:27
I intend to rewrite it for a different engine before I do that, because it unfortunately suffers in a pathological case involving zero-width assertions.
sreservoir
2010-10-03 17:53:39
So =~ operates on [Char] strings, but all the operations pack the [Char] string to a ByteString? You might as well just expose the ByteString to the caller, so you don't have to `pack` all the time. That's slow.
jrockway
2010-10-04 00:11:45
hm. uh, I'll fix that... eventually. or maybe I'll just use `Text.Regex.PCRE` as a base.
sreservoir
2010-10-05 00:09:12
+1
A:
The regular expression API in regex-base is generic to the container of characters to match. Doing some kind of splicing generically to implements substitution would be very hard to make efficient. I did not want to provide a crappy generic routine.
Writing a small function to do the substitution exactly how you want is just a better idea, and it can be written to match your container.
Chris Kuklewicz
2010-10-13 22:08:36