InsertCleverName
asked on
How to match special HTML characters using reg ex in JavaScript?
I'm trying to use a regular expression on a snippet of HTML that contains • (ampersand then 'bull;').
I'm getting the HTML by doing:
var s=document.body.innerHTML;
but this returns the HTML as parsed into a DOM and the special characters - prefixed with ampersands - don't seem to be prefixed with ampersands anymore once the DOM has been created. So just doing:
var arr=s.match(/•/);
won't return anything.
I'm getting the HTML by doing:
var s=document.body.innerHTML;
but this returns the HTML as parsed into a DOM and the special characters - prefixed with ampersands - don't seem to be prefixed with ampersands anymore once the DOM has been created. So just doing:
var arr=s.match(/•/);
won't return anything.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Nice!
Open in new window