Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Avoid recursive replacement using regex

by Loops (Curate)
on Nov 25, 2014 at 12:39 UTC ( #1108345=note: print w/replies, xml ) Need Help??


in reply to Avoid recursive replacement using regex

Sure, just translate this into JavaScript:

my %k = qw(l < g > & &); print "$_ to ".s/(&)amp;|&(l|g)t;/$k{$+}/reg.$/ for qw( &amp; &amp;lt; &amp;gt; &lt; &gt; );
Prints:
&amp; to & &amp;lt; to &lt; &amp;gt; to &gt; &lt; to < &gt; to >
(sorry) :P

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1108345]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (3)
As of 2021-04-16 23:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?