PERL BEGINNERS 41 REGARDING SUBSTITUTION
Date: Fri, 8 Aug 2003 20:51:08 +0530 (IST)

Subject: Regarding substitution
From: visu@no-spam (Visu)

Hi,
=09I have extracted links from a html source using HTML::TokeParser.
I used 'a' as a parameter in get_tag method of HTML::TokeParser.Then I=20
want to substitute something for the links that i have extracted.
But the substitution fails for the links in the below lines.

color=3D"#000000" face=3D"NEWS"><a =20
href=3D"http://www.ani.com/NewsItems.asp?ID=3DCMK20030808091643&Title=
=3DLatest+News+Page&lTitle=3DL%FBP%A3+%F9Nn%A7Ls&Topic=3D0"><big>v=
=A5=FBWd =F9NnV E=AC=FBU Cp=FBXV=F4?: EfN =BF=A7Uu\m</big></big><br>
<big><big>=E1=B1V=D5 L=DAj=D5R=F4u; ?olTpX: T.=A3RmTWm</big></big><=
/a><br>
</font><big><font color=3D"#ae0000" face=3D"Verdana"><strong>.</str=
ong></font><font color=3D"#000000" face=3D"TMNEWS"><a href=3D"http://www.ani.com/NewsItems.asp?ID=3DCMK20030808064834&=
;Title=3DLatest+News+Page&lTitle=3DL%FBP%A3+%F9Nn%A7Ls&Topic=3D0"><=
big>=F9Tvh =FATdL=AC YZd=CF: =CF_W=F4j AW=D1d=CF EfN=BF=A7Uu\m</big></big><br>
<big><big>=FAS=F4h?v</big></big></a><br>
</font><big><big><a =20
href=3D"http://www.ani.com/NewsItems.asp?ID=3DCMK20030807101744&Title=
=3DLatest+News+Page&lTitle=3DL%FBP%A3+%F9Nn%A7Ls&Topic=3D0"></a></b=
ig><strong><font color=3D"#ae0000" face=3D"Verdana">.</font></strong><font color=3D"=
#000000" face=3D"TMNEWS"><a href=3D"http://www.ani.com/NewsItems.asp?ID=3DDNL20030808041423&=
;Title=3DLatest+News+Page&lTitle=3DL%FBP%A3+%F9Nn%A7Ls&Topic=3D0"><=
big>"=F9Tl=A3,
=FAL=F4d =AEtT=FB]d=CFj =FAR=A3V A[=AEp R=FBP':</big></big><br>
<big><big>W=F4UR=F4v =FAL=F4=ACd=FBL</big></big></a><br>

=09

Any direction is welcome.....

regards,
SV

Date: Sat, 09 Aug 2003 10:41:16 -0500

Subject: Re: Regarding substitution
From: wiggins@no-spam (Wiggins D'Anconia)
Visu wrote:
> Hi,
> I have extracted links from a html source using HTML::TokeParser.
> I used 'a' as a parameter in get_tag method of HTML::TokeParser.Then I > want to substitute something for the links that i have extracted.
> But the substitution fails for the links in the below lines.
> > > color="#000000" face="NEWS"><a > > href="http://www.ani.com/NewsItems.asp?ID=CMK20030808091643&Title=Latest+News+Page&lTitle=L%FBP%A3+%F9Nn%A7Ls&Topic=0"><big>v??Wd
> ?NnV E??U Cp?XV??: EfN ??Uu\m</big></big><br>
> <big><big>?V? L?j?R?u; ?olTpX: T.?RmTWm</big></big></a><br>
> </font><big><font color="#ae0000" face="Verdana"><strong>.</strong></font><font
> color="#000000" face="TMNEWS"><a > href="http://www.ani.com/NewsItems.asp?ID=CMK20030808064834&Title=Latest+News+Page&lTitle=L%FBP%A3+%F9Nn%A7Ls&Topic=0"><big>?Tvh
> ?TdL? YZd?: ?_W?j AW?d? EfN??Uu\m</big></big><br>
> <big><big>?S?h?v</big></big></a><br>
> </font><big><big><a > href="http://www.ani.com/NewsItems.asp?ID=CMK20030807101744&Title=Latest+News+Page&lTitle=L%FBP%A3+%F9Nn%A7Ls&Topic=0"></a></big><strong><font
> color="#ae0000" face="Verdana">.</font></strong><font color="#000000" face="TMNEWS"><a
> href="http://www.ani.com/NewsItems.asp?ID=DNL20030808041423&Title=Latest+News+Page&lTitle=L%FBP%A3+%F9Nn%A7Ls&Topic=0"><big>"?Tl?,

> ?L?d ?tT?]d?j ?R?V A[?p R?P':</big></big><br>
> <big><big>W?UR?v ?L?d?L</big></big></a><br>
> >
> > Any direction is welcome.....

We would need to see the code not the lines themselves. As an aside if you are substituting a value for the 'href' attribute you shouldn't use a regex. Let the tokeparser do it for you by changing the attribute using the token's methods.

http://danconia.org

Date: Sun, 10 Aug 2003 22:55:46 +0530 (IST)

Subject: Re: Regarding substitution
From: visu@no-spam (Visu)
On Sat, 9 Aug 2003, Wiggins d'Anconia wrote:

> Visu wrote:
> > Hi,
> > I have extracted links from a html source using HTML::TokeParser.
> > I used 'a' as a parameter in get_tag method of HTML::TokeParser.Then I > > want to substitute something for the links that i have extracted.
> > But the substitution fails for the links in the below lines.
> > > > > > color="#000000" face="NEWS"><a > > > > href="http://www.ani.com/NewsItems.asp?ID=CMK20030808091643&Title=Latest+News+Page&lTitle=L%FBP%A3+%F9Nn%A7Ls&Topic=0"><big>v??Wd
> > ?NnV E??U Cp?XV??: EfN ??Uu\m</big></big><br>
> > <big><big>?V? L?j?R?u; ?olTpX: T.?RmTWm</big></big></a><br>
> > </font><big><font color="#ae0000" face="Verdana"><strong>.</strong></font><font
> > color="#000000" face="TMNEWS"><a > > href="http://www.ani.com/NewsItems.asp?ID=CMK20030808064834&Title=Latest+News+Page&lTitle=L%FBP%A3+%F9Nn%A7Ls&Topic=0"><big>?Tvh
> > ?TdL? YZd?: ?_W?j AW?d? EfN??Uu\m</big></big><br>
> > <big><big>?S?h?v</big></big></a><br>
> > </font><big><big><a > > href="http://www.ani.com/NewsItems.asp?ID=CMK20030807101744&Title=Latest+News+Page&lTitle=L%FBP%A3+%F9Nn%A7Ls&Topic=0"></a></big><strong><font
> > color="#ae0000" face="Verdana">.</font></strong><font color="#000000" face="TMNEWS"><a
> > href="http://www.ani.com/NewsItems.asp?ID=DNL20030808041423&Title=Latest+News+Page&lTitle=L%FBP%A3+%F9Nn%A7Ls&Topic=0"><big>"?Tl?,

> > ?L?d ?tT?]d?j ?R?V A[?p R?P':</big></big><br>
> > <big><big>W?UR?v ?L?d?L</big></big></a><br>
> > > >
> > > > Any direction is welcome.....
> > We would need to see the code not the lines themselves. As an aside if > you are substituting a value for the 'href' attribute you shouldn't use > a regex. Let the tokeparser do it for you by changing the attribute > using the token's methods.

Thanx for your direction.I got the answer using token's methods.
SV