hmm... got to move this to ph-perl .. :) it's getting complicated
On Sun, 21 Jan 2001, jon wrote:
> <a href="#">here</a> <a href="#">there</a> <a href"#">everywhere</a>
>
> would list:
> here
> there
> everywhere
>
> what i did was
>
> undef($/); #undef delimiter, i suppose
> $_ = <infile> #surp the contents of the file
> s/\n/ /; #convert to a long line
> $a = 0; #count
>
if i'm not mistaken, i see 2 problems here.
1. the may be problems with the filter
html tag looks like this <a href="">
> while ( $_ =~ /\<[aA].*\>(.*)\<\/[aA]\>(.*)/g )
there is a mandatory white space after the a so it could look like this
unless it's <a> (which is still valid although it does nothing)
the problem is, the filter would match invalid etries like this
<atagthatstartswitha>some url</a>
/<a|A\s*.*>(.*)<\/a|A>/
note .. havent tried this *yet* but i'll do if i get the time ;)
2. IMHO, i'd use split for the outer loop
foreach $temp (split (/<a|A\s*.*>.*<\/a|A>/, $sourcestr) {
# then filter out those inside the tag
$temp =~ /<a|A\s*.*>(.*)<\/a|A>/;
($1) and do {
# i've got a match
};
}
hth
-mark
as usual, the code snippets above should contain ;)
use DISCLAIMER;
*************************************************************************
Mark Anthony J. Mercado [EMAIL PROTECTED]
Laguna Internet, Incorporated
Rm 404 Vega Centre, Lopez Avenue, Los Banos, Laguna, Philippines 4030
Ph. 63 49 536.0085 Fax. 63 49 536.0067
*************************************************************************
_
Philippine Linux Users Group. Web site and archives at http://plug.linux.org.ph
To leave: send "unsubscribe" in the body to [EMAIL PROTECTED]