Alternate Engines
Starting with v5.10, you can even swap out Perl’s entire regex engine and replace it with an alternate pattern-matching library. The underlying mechanics that make this possible are documented in the perlreapi manpage. It’s pretty tough reading, meant for seriously hardcore hackers only.
But you may be in luck. Thanks to CPAN, Perl plug-ins for the alternate regex engine of your choice may already exist. When you use these, you write your patterns normally and, come time to execute them, the alternate engine takes charge. Table 5-18 shows some CPAN modules that let you use other languages’ regex engines in your Perl code (as they exist on CPAN in autumn 2011). There may be more by the time you read this, so look around.
Table 5-18. Alternate regex engines
| Module | Description | Version | Updated | Current Maintainer |
|---|---|---|---|---|
re::engine::LPEG | The LPEG regex engine | 0.05 | 2010-07-09 | François Perrad |
re::engine::RE2 | Russ Cox’s RE2 regex engine | 0.08 | 2011-04-22 | David Leadbeater |
re::engine::Plugin | General API for writing custom regex engines | 0.09 | 2011-04-05 | Vincent Pit |
re::engine::Plan9 | Regexes from Plan9! | 0.16 | 2010-03-31 | Ævar Arnfjörð Bjarmason |
re::engine::Oniguruma | Ruby’s Oniguruma regex engine | 0.05 | 2011-07-10 | |
re::engine::Lua | Lua’s regex engine | 0.06 | 2008-12-20 | François Perrad |
re::engine::PCRE | Phil Hazel’s Perl-Compatible RegEx engine | 0.17 | 2011-Jan-29 | Ævar Arnfjörð Bjarmason |
(Notice anything about those authors? More than ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access
