HTML Encoded characters -- Perl


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting HTML Encoded characters -- Perl
# 1  
Old 07-26-2010
HTML Encoded characters -- Perl

Hello all

I have a string like

" Have Fun for the rest of the day &#33. I will meet you tomorrow!"

&#33 is the HTML Equivalent of ! symbol.
From the above string, i would like to remove only the HTML encoded special characters.
Output should be like

" Have Fun for the rest of the day . I will meet you tomorrow!"

Please reply
# 2  
Old 07-26-2010
$str =~ s/&#[0-9]+//g;
# 3  
Old 07-26-2010
Quote:
Originally Posted by Corona688
$str =~ s/&#[0-9]+//g;
I got it. Thanks for the reply
But i have a Q again
i jsut came to know that to put a HTML number, we can type $#somenumber or &string.

For greater than symbol
we can say &#62 or &gt.

If the string is like

" 20 &gt than 30. Is &#62 is the right symbol to use. Look for > ".
After stripping HTML Encoded, my output should be like

" 20 than 30. Is is the right symbol to use. Look for > ".

Please reply. I appreciate your response
# 4  
Old 07-26-2010
Quote:
For greater than symbol
we can say &#62 or &gt.
The above are incorrect. You need to add a semi-colon (';') after each of the character entities.
# 5  
Old 07-26-2010
A trivial modification of the previous regex.

$str =~ s/&[^;]+\;//g;
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Writing an HTML file in perl

I'm writing a perl script that writes an html file. use Tie::File; my ($dir) = @ARGV; open (HTML,">","$dir/file.html") || die $!; #-----Building HTML file--------------------------- print HTML "<!DOCTYPE html> <html> <head> <title>Output</title> <link... (3 Replies)
Discussion started by: jrymer
3 Replies

2. Shell Programming and Scripting

Base 64 encoded string

Could anyone of you please give me some idea to decode base 64 encoded value in ksh? (4 Replies)
Discussion started by: nram_krishna@ya
4 Replies

3. Shell Programming and Scripting

Hidden Characters in Regular Expression Matching Perl - Perl Newbie

I am completely new to perl programming. My father is helping me learn said programming language. However, I am stuck on one of the assignments he has given me, and I can't find very much help with it via google, either because I have a tiny attention span, or because I can be very very dense. ... (4 Replies)
Discussion started by: kittyluva2
4 Replies

4. Shell Programming and Scripting

Embedding HTML in Perl script

My webpage is hosted from perlscript(homepage.pl), i want to add piece of html code in the footer of the homepage. I simply pasted the html code at the end of the perl script as below... ======================================================== close(OUTSQL); ... (4 Replies)
Discussion started by: paventhan
4 Replies

5. Shell Programming and Scripting

Converting html to pdf perl

Hi All, I have a requirement of converting an html form into pdf using perl. The html form contains images, tables and css implementation. I tried using various perl modules but failed to achive the target. I succeeded in generating a pdf from the html file using... (2 Replies)
Discussion started by: DILEEP410
2 Replies

6. Shell Programming and Scripting

Perl + Korn + HTML

I have a perl script that prints up the html code and executes a few korn scripts to populate the web code. Disclaimer === I can throw together some korn scripts pretty quick. This code changes pretty frequently. I don't know enough about perl to do everything I need. One day maybe I'll get... (4 Replies)
Discussion started by: i9300
4 Replies

7. Shell Programming and Scripting

HTML parsing by PERL

i have a HTML report file..its in attachment(a part of the whole report is attached..name "input html.doc").also its source is attached in "report source code.txt" i just want to seperate the datas like in first line it should be.. NHTEST-3848498958-NHTEST-10.2-no-baloo a and so on for whole... (3 Replies)
Discussion started by: avik1983
3 Replies

8. Shell Programming and Scripting

Converting %## back to special characters from an HTML form

I have an HTML form that sends email to a large list of users one at a time by matching an email address in peoplesoft to their username. It works great, except that special characters are converted to %## format. Is there a library of these I can use to sed them back (yes this is a crappy UNIX... (1 Reply)
Discussion started by: 98_1LE
1 Replies

9. Shell Programming and Scripting

perl and html

hi. im very new to perl. is it possible to fill up a web form and submit it using perl? example, i would like to sign up for a yahoo account though a perl script (ofcourse, granting the "type the characters as shown in imgage" is absent)? (8 Replies)
Discussion started by: marcpascual
8 Replies

10. Shell Programming and Scripting

Perl: Variable input via HTML

I am completely new to perl and am just going over the tutorials right now. What I am trying to attempt is to take the input from the HTML (in a form) and use those variables in a perl script. I've looked everywhere for a simple example on how to do this and cannot find it or do not understand... (5 Replies)
Discussion started by: douknownam
5 Replies
Login or Register to Ask a Question