Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > FormatText/TreeBuilder Removes Line Breaks

Reply
Thread Tools

FormatText/TreeBuilder Removes Line Breaks

 
 
afrinspray
Guest
Posts: n/a
 
      09-08-2005
I'm working on a program that removes html formatting from an IM
conversation. Right now, I'm storing the conversation in a variable,
where each line of the conversation is broken up by line feeds (a
single \n). Then I do the following:

my $formatter = HTML::FormatText->new;
my $tree = HTML::TreeBuilder->new;
$tree->parse($body);
if ($tree) {
$body = $formatter->format($tree);
$tree->delete;
}

where $body is the entire IM conversation.


This strips the line feeds but I needs to keep those in there. Does
anyone have any other suggestions?

Thanks,
Mike

 
Reply With Quote
 
 
 
 
afrinspray
Guest
Posts: n/a
 
      09-08-2005
I just found the FAQ in comp.lang.perl.misc and I'm considering the
line:

s/<(?:[^>'"]*|(['"]).*?\1)*>//gs

Does anyone have any objections?

Thanks,
Mike

 
Reply With Quote
 
 
 
 
A. Sinan Unur
Guest
Posts: n/a
 
      09-08-2005
"afrinspray" <(E-Mail Removed)> wrote in news:1126212207.757886.146020
@g14g2000cwa.googlegroups.com:

> I just found the FAQ in comp.lang.perl.misc and I'm considering the
> line:
>
> s/<(?:[^>'"]*|(['"]).*?\1)*>//gs
>
> Does anyone have any objections?


Uhmmmm ... to what?

Sinan


--
A. Sinan Unur <(E-Mail Removed)>
(reverse each component and remove .invalid for email address)

comp.lang.perl.misc guidelines on the WWW:
http://mail.augustmail.com/~tadmc/cl...uidelines.html
 
Reply With Quote
 
John W. Krahn
Guest
Posts: n/a
 
      09-11-2005
afrinspray wrote:
> I just found the FAQ in comp.lang.perl.misc and I'm considering the
> line:
>
> s/<(?:[^>'"]*|(['"]).*?\1)*>//gs
>
> Does anyone have any objections?


Yes, I strenuously object!


John
--
use Perl;
program
fulfillment
 
Reply With Quote
 
afrinspray
Guest
Posts: n/a
 
      09-21-2005
"are you english or retarded?"
- Alex Trabek

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Beginner: read $array with line breaks line by line Marek Stepanek Perl Misc 12 09-02-2006 10:27 AM
Force multi line field value to output with line breaks? bernadou ASP .Net Web Controls 2 01-23-2006 01:23 PM
[OT] Microsoft's AntiSpyware Tool removes Internet Explorer T-Bone MCSE 11 01-19-2005 08:18 PM
VS.NET designer removes runat='server' attribute in <title> =?Utf-8?B?Q2FybG8gTWFyY2hlc29uaQ==?= ASP .Net 1 07-15-2004 03:24 AM
VS.NET removes "Runat=Server" without asking??? Ronald Colijn ASP .Net 1 11-27-2003 09:01 AM



Advertisments