CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Regular Expressions:
Highlighting words


New User

Aug 10, 2002, 12:17 AM

Post #1 of 3 (9003 views)
Highlighting words Can't Post

I'm wondering if I could get some help with the following. I'm trying to highlight a word within an HTML page. The word can be any string or char. How would I go about it so I only highlight the content and not an HTML tag. I'm using the span style tag for highlight.

So if I want to highlight the word "a" in the whole document, I want to highlight just the word "a" from the content, not from any HTML tags. Anyone know a solution? Thanks, I appreciate it.

Thaumaturge / Moderator

Aug 10, 2002, 1:32 AM

Post #2 of 3 (9002 views)
Re: [TheLoneGunMan] Highlighting words [In reply to] Can't Post

Regular expressions are almost certainly the wrong tool for this job. Regex-based parsing of hierarchically structured text will always break at some point.

A better idea would be to use HTML::Parser or one of its subclasses. HTML::TreeBuilder might be a good idea.

Dave Cross, Perl Hacker, Trainer and Writer
Get more help at Perl Monks

New User

Aug 10, 2002, 12:51 PM

Post #3 of 3 (8996 views)
Re: [davorg] Highlighting words [In reply to] Can't Post

Thanks for the feed back. It was of top priority on my list. This is my first post on this forum, and on most other forums that I visit, most people only just refer to only one section of the forum, and they never see the post. Sorry for any miscovenience.


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives