This reminds me a of a similar thing I did in Apache::AddrMunge, which is an Apache plugin module I wrote that mangles my mail address on my web pages.

The code looks like this:

s{\b(mjd[-\w]*) \@ ( (?:\w+\.)? plover\.com \b) } {($a,$b) = ($1,$2); $a =~ m{-subscribe$} ? "$a\@$b" : "$a-id-$id\@$b" }gex;
It turns an address like mjd-perl-pause@www.plover.com into mjd-perl-pause-id-iws+bx9zvct@www.plover.com, unless the address is a mailing list subscribe address such as mjd-perl-memoize-subscribe@plover.com.

This page has a detailed description of a similar solution to a problem, but if you read it, be sure to start here instead and read backwards up the page. The end result:

s{(.*?)(\`([^\']*)\')} {$pos += length $1; my $length = length $2; print ((' ' x ($pos)), "^", (' ' x ($length-2)), "^ ? "); my $r = lc <STDIN>; $pos += $length; (substr($r,0,1) eq 'n') ? $& : "$1<tt>$3</tt>" }eg;

In reply to Re: replace all spaces within anglebrackets with underscores by Dominus
in thread replace all spaces within anglebrackets with underscores by merlyn

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.