# Mass filtering page content for javascript anti-spam script

**URL:** <https://www.ruby-forum.com/t/mass-filtering-page-content-for-javascript-anti-spam-script/75800>\
**Category:** Rails\
**Created:** [November 13, 2006, 4:37pm UTC](https://www.ruby-forum.com/t/mass-filtering-page-content-for-javascript-anti-spam-script/75800 "2006-11-13T16:37:14Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![tomtt](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/e47c2d/32.png) [@tomtt](https://www.ruby-forum.com/u/tomtt)\
**Post date:** [November 13, 2006, 4:37pm UTC](https://www.ruby-forum.com/t/mass-filtering-page-content-for-javascript-anti-spam-script/75800/1 "2006-11-13T16:37:14Z")

</div>

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,

Tom

---

<div class="post-metadata">

**Author:** ![tomtt](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/e47c2d/32.png) [@tomtt](https://www.ruby-forum.com/u/tomtt)\
**Post date:** [November 13, 2006, 5:05pm UTC](https://www.ruby-forum.com/t/mass-filtering-page-content-for-javascript-anti-spam-script/75800/2 "2006-11-13T17:05:56Z")

</div>

Tom T. wrote:

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

Dan Bejamin’s hivelogic enkoder is available as a rails plugin.

> **[Dan Benjamin](https://danbenjamin.com)**
>
> Dan Benjamin's personal website.

A.

---

<div class="post-metadata">

**Author:** ![tomtt](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/e47c2d/32.png) [@tomtt](https://www.ruby-forum.com/u/tomtt)\
**Post date:** [November 13, 2006, 5:13pm UTC](https://www.ruby-forum.com/t/mass-filtering-page-content-for-javascript-anti-spam-script/75800/3 "2006-11-13T17:13:19Z")

</div>

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  
there.  
[http://www.agilewebdevelopment.com/plugins/form\_spam\_protection](http://www.agilewebdevelopment.com/plugins/form_spam_protection)

---

<div class="post-metadata">

**Author:** ![tomtt](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/e47c2d/32.png) [@tomtt](https://www.ruby-forum.com/u/tomtt)\
**Post date:** [November 13, 2006, 5:53pm UTC](https://www.ruby-forum.com/t/mass-filtering-page-content-for-javascript-anti-spam-script/75800/4 "2006-11-13T17:53:30Z")

</div>

On Nov 13, 4:05 pm, Alan C Francis [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> Dan Bejamin’s hivelogic enkoder is available as a rails plugin.

Amazing! Thank you!

---

<div class="post-metadata">

**Author:** ![tomtt](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/e47c2d/32.png) [@tomtt](https://www.ruby-forum.com/u/tomtt)\
**Post date:** [November 13, 2006, 8:06pm UTC](https://www.ruby-forum.com/t/mass-filtering-page-content-for-javascript-anti-spam-script/75800/5 "2006-11-13T20:06:02Z")

</div>

On Nov 13, 4:49 pm, “Tom T.” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> 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?
