Francois Perrad

NAME

re::engine::LPEG - LPEG regular expression engine

SYNOPSIS

    use re::engine::LPEG;

    if ('Hello, world' =~ m{ ( 'Hello' / 'Hi' ) ', ' { 'world' } });
        print "Greetings, $1!";
    }

DESCRIPTION

THIS MODULE IS A FAILURE. THE re-engine INTERFACE IS NOT THE RIGHT WAY TO WRAP LPeg.

Replaces perl's regex engine in a given lexical scope with the LPeg one.

See "Regex syntax for LPEG", on http://www.inf.puc-rio.br/~roberto/lpeg/re.html.

Common Pitfalls

  • Literal string must be quoted or double quoted. Spaces are not significatives.

  • LPeg works only in anchored mode. So LPeg is unusable with split, and not suitable for s///.

  • '/' represents an ordered choice, so the syntax 'm{pattern}' is more readeable than '/pattern/' where '/' must be escaped.

  • Pre-defined character classes start by '%' (like in the Lua string library). See http://www.lua.org/manual/5.1/manual.html#5.4.1.

AUTHORS

François PERRAD <francois.perrad@gadz.org>

HOMEPAGE

The development is hosted at http://code.google.com/p/re-engine-lpeg/.

COPYRIGHT

Copyright 2008 François PERRAD.

This program is free software; you can redistribute it and/or modify it under the same terms as Lua & LPeg, see http://www.lua.org/license.html.