For Programmers: Free Programming Magazines  


Home > Archive > PERL Miscellaneous > June 2005 > Removing whitespace and quotes from the end of HTML









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Removing whitespace and quotes from the end of HTML
unknownsoldier93@yahoo.com

2005-06-09, 3:57 am

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   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. Sinan Unur

2005-06-09, 3:57 am

unknownsoldier93@yahoo.com wrote in news:1118280417.715640.184880
@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
--
A. Sinan Unur <1usa@llenroc.ude.invalid>
(reverse each component and remove .invalid for email address)

comp.lang.perl.misc guidelines on the WWW:
http://mail.augustmail.com/~tadmc/c...guidelines.html
unknownsoldier93@yahoo.com

2005-06-09, 3:57 am

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. Sinan Unur

2005-06-09, 3:57 am

unknownsoldier93@yahoo.com wrote in news:1118284291.948822.239080@g14g2000cwa.googlegroups.com:

[ 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

socialism001@yahoo.com
unknownsoldier93@yahoo.com
abracad_1999@yahoo.com

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?

<URL: http://theoryx5.uwinnipeg.ca/CPAN/p...m_a_string.html>

>(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
--
A. Sinan Unur <1usa@llenroc.ude.invalid>
(reverse each component and remove .invalid for email address)

comp.lang.perl.misc guidelines on the WWW:
http://mail.augustmail.com/~tadmc/c...guidelines.html
unknownsoldier93@yahoo.com

2005-06-09, 3:57 am

Yes, Ithaca is gorgeous.

unknownsoldier93@yahoo.com

2005-06-09, 3:57 am

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).

unknownsoldier93@yahoo.com

2005-06-09, 3:58 pm

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

Jürgen Exner

2005-06-10, 3:59 am

unknownsoldier93@yahoo.com wrote:
> 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


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2009 codecomments.com