473,224 Members | 1,658 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,224 software developers and data experts.

HTML to Plain Text

Can anybody suggest how to remove html tags while displaying the output

consider code as
<b> name </b>

now i want to display output in perl as
name.


reply as soon as possible.....
Feb 19 '07 #1
4 22391
KevinADC
4,059 Expert 2GB
if you don't need or want to go the full html parser route:

http://perldoc.perl.org/perlfaq9.htm...om-a-string%3F

but if you do:

http://search.cpan.org/author/GAAS/H...3.56/Parser.pm
Feb 19 '07 #2
miller
1,089 Expert 1GB
You basically have three options (and variations there of). Which method you choose depends on what the content of your html is, and what type of output that you want. Most likely, you'll use either method #1 or #3.

1) Remove Tags using a regular expression (Quick and Dirty) (Kevin's Suggestion #1)

Perl FAQ 9 - Removing HTML from String

2) HTML Parser - By tag parsing of html (Complicated and Verbose) (Kevin's Suggestion #2)

cpan HTML::Parser

3) HTML::FormatText - Generic Parsing of HTML to Plain Text

cpan HTML::FormatText
Feb 19 '07 #3
Thks frds for yr replies,



My problem got solved by using follwing code line

$record=~s/<.*?>/ /g;
Feb 21 '07 #4
miller
1,089 Expert 1GB
Thks frds for yr replies,

My problem got solved by using follwing code line

$record=~s/<.*?>/ /g;
Well done.

That was the first method suggested in the FAQ link. Read the first paragraph (excerpted below) to make sure that you aren't overlooking anything if this is a repeated need:

Many folks attempt a simple-minded regular expression approach, like s/<.*?>//g, but that fails in many cases because the tags may continue over line breaks, they may contain quoted angle-brackets, or HTML comment may be present. Plus, folks forget to convert entities--like &lt; for example.
Feb 21 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

10
by: J. Alan Rueckgauer | last post by:
Hello. I'm looking for a simple way to do the following: We have a database that serves-up content to a website. Some of those items are events, some are news articles. They're stored in the...
1
by: Karl B | last post by:
Hi all. Iv'e tryed out xp_smtp_sendmail, and I like what I can see so far. The thing I wonder about is if the xp supports sending both html AND plain text in the same mail. I'm on a sql2000 sp3 and...
14
by: Akseli Mäki | last post by:
Hi, Hopefully this is not too much offtopic. I'm working on a FAQ. I want to make two versions of it, plain text and HTML. I'm looking for a tool that will make a plain text doc out of the...
8
by: LRW | last post by:
I'm not sure this message is totally appropriate for this group, so please, if anyone has a better group suggestion, let me know! My company sends out a monthly newsletter in HTML format to our...
3
by: tdeclercq | last post by:
HI, I want to be sure that users receive and can read my mails. How can I send mail in HTML AND text Format in one send ? thx
58
by: Jeff_Relf | last post by:
Hi Tom, You showed: << private const string PHONE_LIST = "495.1000__424.1111___(206)564-5555_1.800.325.3333"; static void Main( string args ) { foreach (string phoneNumber in Regex.Split...
10
by: Eric Lindsay | last post by:
This may be too far off topic, however I was looking at this page http://www.hixie.ch/advocacy/xhtml about XHTML problems by Ian Hickson. It is served as text/plain, according to Firefox...
6
by: monomaniac21 | last post by:
hi all how can u send a plain text version of an email with the html so that the users mail client can access this plain text version? kind regards marc
0
by: Rey | last post by:
Howdy all. Am using visual web developer 2005 (vb), xp pro sp2. In testing of the system.net.mail to send email from an aspx page where I'm pulling the email contents from a textbox, find that...
2
by: =?Utf-8?B?Q2FwdGFpbiBEYXZlIQ==?= | last post by:
I wrote some code to send an email with two alternate views: 1) html 2) plain text All the html enabled email clients accept the html just fine and disregard the plain text version. However,...
1
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: mar23 | last post by:
Here's the situation. I have a form called frmDiceInventory with subform called subfrmDice. The subform's control source is linked to a query called qryDiceInventory. I've been trying to pick up the...
2
by: jimatqsi | last post by:
The boss wants the word "CONFIDENTIAL" overlaying certain reports. He wants it large, slanted across the page, on every page, very light gray, outlined letters, not block letters. I thought Word Art...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.