Invoking a modifing method for backreferences in Perl5Util.substitute

"Sann, Stephan" <[email protected]> Fri, 4 Mar 2005 09:24:59 +0100
Newsgroups gmane.comp.jakarta.oro.user
Message-ID <[email protected]>
Hello,

I realy tried hard to find something about this issue on Google and the
ORO-mailing-list, but couldn't find anything. If there should be any
howto on this, just send me a RTFM and a link - thanks!

Now my question:
With "Perl5Util.substitute" - is it possible to modify a backreference
before pasting it back in?

An example:

        StringBuffer regExpr =3D new StringBuffer();
        =
regExpr.append("s#\"cid:(.*?)\"#\"").append(encRetrieveActionLink);
        regExpr.append("$1\"#gi");

I would like to URL-encode the $1-backreference.


With PHP there's the 'e'-modifier:

<?php
preg_replace("/(<\/?)(\w+)([^>]*>)/e",
             "'\\1'.strtoupper('\\2').'\\3'",
             $html_body);
?>

This would capitalize all HTML tags in the input text.=20


Any chance with Perl5Util? If not - is there any workaround?


Thanks a lot in advance!

Best regards
Stephan
--
"...Linux, Windows XP, and MS-DOS (also known as the Good, the Bad, and =
the Ugly)."