Franklin Zhang [FZ], on Wednesday, September 15, 2004 at 11:20 (+0800)
wrote these comments:


FZ> Now, there are three kind of URL that I want to extract:
FZ> 1.<td valign="top" nowrap="nowrap" align="left"><a target="_self"
FZ> 
href="/Archives/1190192/000101968704002050/0001019687-04-002050-index.htm">2</a></td>
FZ> 2.<td valign="top" nowrap="nowrap" align="left"><a target="_self"
FZ> 
href="/Archives/1190192/000101968704002050/0001019687-04-002050-index.htm">2abcd</a></td>
FZ> 2.<td valign="top" nowrap="nowrap" align="left"><a target="_self"
FZ> 
href="/Archives/1190192/000101968704002050/0001019687-04-002050-index.htm">3</a></td>
 
FZ> I just want to extract the first URL which fits my condition, so I use:
FZ> if($line=~m/href="((?:[^"\\]|\\.)*)">2/)

if($line=~m/href="((?:[^"\\]|\\.)*)">2/)
maybe you can change it to
if($line=~m/href="((?:[^"\\]|\\.)*)">2</)

if ">2<" is condition.

but why you regexp is so difficult ? what about this ?

if ( $line =~ /href="([^")">2</ )

-- 

 ...m8s, cu l8r, Brano.

[Does the Postmaster General need a stamp of approval?]



-=x=-
Skontrolovan� antiv�rov�m programom NOD32


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to