Removing whitespace and quotes from the end of HTML

Discussion in 'Perl Misc' started by unknownsoldier93@yahoo.com, Jun 9, 2005.

  1. Guest

    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?
     
    , Jun 9, 2005
    #1
    1. Advertising

  2. 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 <>
    (reverse each component and remove .invalid for email address)

    comp.lang.perl.misc guidelines on the WWW:
    http://mail.augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html
     
    A. Sinan Unur, Jun 9, 2005
    #2
    1. Advertising

  3. Guest

    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... :)
     
    , Jun 9, 2005
    #3
  4. wrote in news::

    [ 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





    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/perl/pod/perlfaq9/How_do_I_remove_HTML_from_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 <>
    (reverse each component and remove .invalid for email address)

    comp.lang.perl.misc guidelines on the WWW:
    http://mail.augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html
     
    A. Sinan Unur, Jun 9, 2005
    #4
  5. Guest

    Yes, Ithaca is gorgeous.
     
    , Jun 9, 2005
    #5
  6. Guest

    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).
     
    , Jun 9, 2005
    #6
  7. Guest

    Bickering aside, can anyone help me with this? Perl experts, where are
    you?
     
    , Jun 9, 2005
    #7
  8. 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
     
    Jürgen Exner, Jun 10, 2005
    #8
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Chris White

    Quotes/Double Quotes in Image Control

    Chris White, Sep 22, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    4,872
    Hermit Dave
    Sep 22, 2004
  2. Chris
    Replies:
    1
    Views:
    13,688
    Oisin
    Mar 24, 2006
  3. Oli Filth
    Replies:
    9
    Views:
    3,348
    Uncle Pirate
    Jan 17, 2005
  4. Replies:
    10
    Views:
    768
    Eric Brunel
    Dec 16, 2008
  5. MRAB
    Replies:
    3
    Views:
    394
Loading...

Share This Page