Content = Rereplace(content, "<p[^>]*>", "<----PARAGRAPH_TAG---->", "all");
Content = Rereplace(content, "</p[^>]*>", "<----/PARAGRAPH_TAG---->",
"all");
Content = Rereplace(content, "<br[^>]*>", "<----BREAK_TAG---->", "all");
Content = Rereplace(content, "<[a-zA-Z][^>]*>", "", "all");
Content = replace(content, "<----PARAGRAPH_TAG---->", "<p>", "all");
Content = replace(content, "<----/PARAGRAPH_TAG---->", "</p>", "all");
Content = replace(content, "<----BREAK_TAG---->", "<br />", "all");

That won't work if you have stray angle brackets floating around, but if
it's well formed, it'll do it.

Cheers,
banreyb

> -----Original Message-----
> From: Parker, Kevin [mailto:[EMAIL PROTECTED]
> Sent: Thursday, March 11, 2004 3:05 PM
> To: CF-Talk
> Subject: Stripping HTML
>
> I am setting up some script to monitor a mail box and suck
> newly arriving
> emails into a database for a pro bono site I do. It will
> essentially be
> retrieving email releases sent by email and display them in
> the site. The
> problem I have is that since November last year the
> organisation in question
> decided to start sending these in HTML based email messages. All the
> thousand or so I have before that are plain text so they're
> not a problem.
> I want to suck the HTML ones into the site's database so that
> the HTML is
> stripped out (so that the site style sheets etc can control
> display) but
> retain any <p> or <br> tags in the message. Any guidance
> greatly appreciated
> - thank you!!!
>
>
> +++++++++++++++++++
> Kevin Parker
> Web Services Manager
> WorkCover Corporation
>
> p: 08 8233 2548
> e: [EMAIL PROTECTED]
> w: www.workcover.com
> +++++++++++++++++++
>
> **************************************************************
> **********
> This e-mail is intended for the use of the addressee only. It may
> contain information that is protected by legislated confidentiality
> and/or is legally privileged. If you are not the intended
> recipient you
> are prohibited from disseminating, distributing or copying
> this e-mail.
>
> Any opinion expressed in this e-mail may not necessarily be
> that of the
> WorkCover Corporation of South Australia. Although precautions have
> been taken, the sender cannot warrant that this e-mail or any files
> transmitted with it are free of viruses or any other defect.
>
> If you have received this e-mail in error, please notify the sender
> immediately by return e-mail and destroy the original e-mail and any
> copies.
> **************************************************************
> **********
>
>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to