Come for the quick hacks, stay for the epiphanies. | |
PerlMonks |
Re: Substringing HTML contentby fuzzysteve (Beadle) |
on Jan 07, 2005 at 18:40 UTC ( [id://420336]=note: print w/replies, xml ) | Need Help?? |
While it's messy as hell, as an interim solution, write a subroutine that goes though it character by character which records the following things: total characters so far if you are in a tag (i.e. started with a <) what the last character was how many tags you are in how many open tags there are (img could be problematic with this. ditto on any other atomic tags. xhtml would be easier) what the open tags are and what order they are in from that you should be able to run through the characters, taking note of all the tags that you'll need to close at the end. not fun, and hopefully theres a better solution.
In Section
Seekers of Perl Wisdom
|
|