Announcing : Text.Regex.Lazy (0.33)
Where : http://sourceforge.net/projects/lazy-regex
Who : Chris Kuklewicz
License : BSD, except for DFAEngine.hs which is LGPL (derived from CTK
What: This is an alternative to Text.Regex along with some enhancements.
Text.Regex marshals the data back and forth to c-arrays to call libc and
far too slow (and strict). This module understands regular expression
via a Parsec parser and creates an internal data structure
(Text.Regex.Lazy.Pattern). This is then transformed into a Parsec parser
process the input String, or into a DFA table for matching against the
String or FastPackedString. The input string is consumed lazily, so it may
an arbitrarily long or infinite source.
The main modules of interest are:
(*) Text.Regex.Lazy.Compat is supposed to be a drop in replacement for
Text.Regex which uses Parsec and lazy matching.
(*) Text.Regex.Lazy.Full allows for different strategies and for expanded
. This uses Parsec and a choice of lazy or strict matching.
(*) Text.Regex.Lazy.CompatDFA uses a fast lazy DFAEngine for regex
(*) And an early version of Text.Regex.Lazy.DFAEngineFPS applies the
to a Data.FastPackedString (untested).
Why might you use this?
(+) You would rather not translate a regular expression into
a hard coded predicate for matching or filtering a string.
(+) You can parse something via parenthesized subgroup capture of a regular
expression and not have to write all the parsec manually.
(+) You need to filter a large input (from stdin, for example) with a regex
want to do it lazily instead of all at once.
(+) You want to build your own extensions to regex syntax for your project
would rather not have to rewrite one of the c-libraries to do it.
What might you contribute?
(.) Use it and report rough edges, incompatibilities, and bugs.
(.) You can think of clever analysis and optimizations (e.g. taking the
data as input).
(.) Your favorite extended syntax (e.g. giving meaning to various
(.) You have a sinister regular expression & input to contribute as an evil