highlight (ActionView::Helpers::TextHelper)

I'm using that helper function with a search form to highlight the typed phrase in the content BUT when my content is HTML, I'll get replacement where I don't want to. For instance :

@page.content = "<p><a href='ajaxian.com' title='Ajaxian.com'><img src='ajax-image.gif' alt='Ajax Image'/>My text containing AJAX</a></p>"

What I get : highlight (@page.content, 'ajax')

=> <p><a href='<span class="highlight">ajax</span>ian.com' title='<span

class="highlight">Ajax</span>ian.com'><img src='<span class="highlight">ajax</span>-image.gif' alt='<span class="highlight">Ajax</span> Image'/>My text containing <span class="highlight">ajax</span></a></p>

What I want to get : highlight (@page.content, 'ajax')

=> <p><a href='ajaxian.com' title='Ajaxian.com'><img src='ajax-image.gif' alt='Ajax Image'/>My text containing <span class="highlight">ajax</span></a></p>

Don't know much to RegExp, is this possible to do ?

This list is for development of Rails itself. Check out the regular rails mailing list for your question. Kev