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.
InsertCleverNameAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Michel PlungjanIT ExpertCommented:
Hmm, that was interesting
<div id="x">
&bull; Bullet<br>
&bull; Bullet<br>
&bull; Bullet<br>
&bull; Bullet<br>
</div>
<div id="y" style="display:none">&bull;</div>
<script>
var s = document.getElementById('x').innerHTML;
var bull = document.getElementById('y').innerHTML;
var re = eval('/'+bull+'/g')
var s=s.replace(re,'&copy;');
document.getElementById('x').innerHTML=s;
</script>

Open in new window

0
Michel PlungjanIT ExpertCommented:
Here without the hidden div

<div id="x">
&bull; Bullet<br>
&bull; Bullet<br>
&bull; Bullet<br>
&bull; Bullet<br>
</div>
<script>
var s = document.getElementById('x').innerHTML;
var re = eval('/'+unescape('%u2022')+'/g')
var s=s.replace(re,'&copy;');
document.getElementById('x').innerHTML=s;
</script>
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
InsertCleverNameAuthor Commented:
Nice!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.