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 = "&gt;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 [^ ;].
In reply to Re: Question for regex experts
by hdb
in thread Question for regex experts
by evgen-i
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |