Page is a not externally linkable
- Code, Content, and Presentation
-- HTML
---- regex for correcting &


lucy24 - 11:09 pm on Oct 17, 2012 (gmt 0)


Do you mean it never matches, or it only sometimes matches?

When you say &#38 I hope you mean & with closing semicolon. Most browsers will display it without, but it isn't formally correct. fwiw, I always use &

If you're adding html markup to existing text, it is definitely easier to do ampersands before anything else at all. Then you can just replace them globally. (I'm speaking from an e-books perspective.)

It doesn't matter what comes before the &. You have to look at what comes after it-- and that depends on what state your text is in. A lookahead may be the best approach:
&(?!#|mdash;|amp;) and so on.


Thread source:: http://www.webmasterworld.com/html/4508908.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com