Removing whitespace and quotes from the end of HTML

  • Thread starter unknownsoldier93
  • Start date
U

unknownsoldier93

Hi. I'd like to use Perl to remove off the end of HTML any whitespace.
A simple s/\s*$//s won't suffice, since, in HTML, whitespace can look
like <pre> </pre> or &nbsp; etc.

(The HTML is stored in a local perl $variable.)

Also, I'd like to remove any <blockquote>blah blah blah</blockquote> at
the END of the document ONLY (ie, but not from the middle of the page).
Again, a simple s/<blockquote.*?\/blockquote>$//s won't suffice, since
blockquotes can be nested.

Any ideas?
 
A

A. Sinan Unur

(e-mail address removed) wrote in @g44g2000cwa.googlegroups.com:
Hi. I'd like to use Perl to remove off the end of HTML any whitespace.
....

Also, I'd like to remove any <blockquote>blah blah blah</blockquote>
....

Any ideas?

You are supposed to check the FAQ before you post a question.

Besides, what's up with posting half a dozen FAQs each using a different
email address?

Sinan
 
U

unknownsoldier93

I think you are confusing me with someone else. This is my first post.
These issues are not discussed in the FAQ - read them carefully (they
seem simple, but the complications make them quite difficult - I have
been programming Perl for over 5 years and am having trouble.)

(It's okay, I know Cornell can be a stressful place and so you need an
outlet... :)
 
A

A. Sinan Unur

(e-mail address removed) wrote in
[ Please quote some context when you are replying. ]
I think you are confusing me with someone else.

Maybe.

But the style used in the posts by

(e-mail address removed)
(e-mail address removed)
(e-mail address removed)

are very similar in style and attitude.
This is my first post.

In that case, you should definitely consult the posting
guidelines for this group.
These issues are not discussed in the FAQ - read them carefully

Really?

(they seem simple, but the complications make them quite difficult -
I have been programming Perl for over 5 years and am having trouble.)

You'll need to put together some code. It shouldn't be too hard to put
together some code using CPAN modules and ask questions here if you run
into problems.
(It's okay, I know Cornell can be a stressful place and so you need an
outlet... :)

Actually, the students have left, and summer has finally arrived in Ithaca,
so I have ample time to relax by the lake, or the many gorges.

Sinan
 
U

unknownsoldier93

About the FAQ - Please read my question *carefully*. Yes, I know about
regexes and HTML Parser. My difficulty is with *nested* blockquotes,
combined with the fact that I only want to remove them if they are at
the end (not including any whitespace or html whitespace).
 
U

unknownsoldier93

Bickering aside, can anyone help me with this? Perl experts, where are
you?
 
J

Jürgen Exner

Bickering aside, can anyone help me with this? Perl experts, where
are you?

Help with what?
Please quote enough context such that people have a chance to know what you
are talking about.

jue
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top