Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Question for regex experts

by Sandy (Curate)
on Jun 27, 2013 at 12:18 UTC ( [id://1041001]=note: print w/replies, xml ) Need Help??


in reply to Question for regex experts

perl -e '$x=qw(&apm;gt;lt;amp;);$x=~s/;(.)/;&$1/g;print $x,"\n";'

Replies are listed 'Best First'.
Re^2: Question for regex experts
by evgen-i (Novice) on Jun 27, 2013 at 12:29 UTC
    Thanks, but this is just a solution for this particular example; I need a general solution for any codes.

      You need to implement a lookup table that contains a list of all possible, or otherwise a subset, of HTML character codes.

      Therefore, each time your program encounters

      code;
      instead of
      &code;
      , it will need to add an ampersand at the start.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (3)
As of 2025-07-12 19:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.