[Haskell] Regular Expressions - take 2

John Meacham john at repetae.net
Thu Feb 26 15:29:53 EST 2004


I went ahead and implemented Perl Compatable Regular Expression support
as well as a module which uses template haskell to check regular
expressions at runtime.

The full set of modules is
RRegex         - PCRE if available, else Posix, (compatable with Text.Regex)
RRegex.PCRE    - Perl compatable regular expressions 
RRegex.Posix   - posix regular extensions (compatable with Text.Regex.Posix)
RRegex.TH      - template haskell compile-time checked regular expressions
RRegex.Syntax  - perl like overloaded matching syntax

Along the way, I extende the Posix interface, as the one in
Text.Regex.Posix was lacking in several key ways.

among the more interesting changes are
ability to use (?options) syntax with posix expressions
all of PCRE goodness. which is a lot.
much better error messages (compile-time when using TH)
example:
> Fail: user error (PCRE Regular Expression Error:
> [a-z_A-Z]+\(.*);
>               ^ unmatched parentheses)
notice it points out the exact spot of the error.
ability to pull out offset,length integer pairs, rather than extracting
the substrings
all the =~ stuff mentioned in my previous email.

see the sort-of homepage here:
http://haskell.org/hawiki/RegexSyntax
and haddock documentation here:
http://repetae.net/john/computer/haskell/hsregex/hsregex/docs/index.html

        John


-- 
---------------------------------------------------------------------------
John Meacham - California Institute of Technology, Alum. - john at foo.net
---------------------------------------------------------------------------


More information about the Haskell mailing list