Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Question for regex experts

by hdb (Parson)
on Jun 27, 2013 at 12:53 UTC ( #1041009=note: print w/ replies, xml ) Need Help??


in reply to Question for regex experts

I am not sure my proposal will not create havoc elsewhere in your html (ie how robust it is) but have a look:

use strict; use warnings; my $html = ">lt;amp; something else <gt;amp;something else ; +"; $html =~ s|&(([^ ;]+;)+)| join '', map { "&$_;" } split /;/, $1 |ge; print "$html\n";

UPDATE: Probably \w is more robust than [^ ;].


Comment on Re: Question for regex experts
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (3)
As of 2014-08-30 02:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (291 votes), past polls