Mass filtering page content for javascript anti-spam script

Hi all,

I'd like to write a function that replaces all email addresses in my
pages with a javascript anti-spam script. I know it's a bit horrible
for screen readers, but I feel it's our best option at the moment.

I think I need some kind of function that builds the javascript
depending on the email address and then replaces it in the text. I got
a bit lost at this point!

All of the page content is written in Markdown, fetched from the
database, and is edited regularly by the site users.

Has anyone done anything like this, or know where I could start?

Thanks a lot,


I wrote a plugin that automatically adds an enkoded (Hivelogic Enkoder
is Javascript eval) hidden field to prevent spam. Perhaps not that
relevant to what you're trying to do, but thought I'd throw it out

Amazing! Thank you!

Actually, it appears that's a little overkill for what I want. That
encodes an entire page of content, and I just want to encode the email
addresses. There must be some kind of regexp I could use?