You can replace the entities even if they are already right with s{ \&? \b (amp|lt|gt) ; }{&$1;}xg;. And you can generate the OR list (in parenthesis) with a map. Edit : Here the &? catches the ampersand if it's there so that the substitution does not add another one. The \b makes sure that you have something that looks like a failed HTML entity. You wouldn't want "Tom bought a lamp; he loves lamps" to become "Tom bought a l& he loves lamps" for example.
In reply to Re: Question for regex experts
by Eily
in thread Question for regex experts
by evgen-i
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |