Perls regex engine is very closely bonded to the perl internals, so writing a plug in replacement isnt going to be easy. However, as of Perl 5.9.5 it should be much easier, as the framework has been totally changed. In earlier versions of perl the swap of regex engines was interpreter wide, which meant that patterns compiled with one engine could and would be handed over to another for processing. As long as the engine being plugged in was just a "debug" build of the original this didnt lead to problems, but if you were to plug in a set of empty handlers all hell would break loose.

The new interface involves binding the internal structures with a dispatch table so that regexp's are executed using the same engine as they were compiled with. As abyproduct the use re 'debug'; pragma is now properly lexically scoped.

So the short of it is, its not easy to do, and requires advanced C/perl internals skills. However, in comparison to earlier perls it is actually possible.

One of my personal ambitions for 5.10 is to include a module that implements a plug in of another regex library. I dont know if ill acomplish it, but it is something id like to do.

---
$world=~s/war/peace/g


In reply to Re: overload =~ operator by demerphq
in thread overload =~ operator by dk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.