Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

Re: Help on using alternation grouping star versus dot star.

by andreychek (Parson)
on Jun 10, 2001 at 08:01 UTC ( #87267=note: print w/replies, xml ) Need Help??

in reply to Help on using alternation grouping star versus dot star.

Well, I'll leave the regular expression evaluating to the guru's here.. :-) However, you asked if there are other ways to handle what you are looking to do, so I'll offer two.

There are two modules at CPAN, HTML::Parser and HTML::TokeParser.

HTML::Parser is an event driven HTML code parser. It parses through your document, and calls a function of your choice upon seeing any HTML Start Tag. Whenever it hits an HTML End Tag, it also calls a function of your choice. You could use this method to rewrite your HTML code, by having the functions HTML::Parser calls test to see if the tag is named "div". If so, you can change the name. I'm not sure how it handles attribute tags though.

I personally have had more luck with HTML::TokeParser. It would allow you to write code such as:
Which would find the next div start tag. If it returns something, you can first test it's attributes. If the class attribute equals "blackqte", you could have some code to rewrite the entire tag. HTH!

Update: I may have misunderstood what you are looking for, but if you really are looking for a Javascript solution, and not Perl.. my particular answer won't help you at all. Sorry :-)

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://87267]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (4)
As of 2018-03-21 05:27 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (263 votes). Check out past polls.