Hi all,
 
I've been writing in Perl for quite some time now, however regular
expressions have eluded me. I'm not completely sure why, but they have.
Now that I need them I figure I better get some assistance soon.
 
I'm trying to extract the linked text out of an html string. I thought
that matching text between ">" and "</a>" would be the best way to do
this. I came up with the following line of code:
 
$line2 = string to be parsed.
 
 ($linkname) = ($line2 =~ m/>[:alpha:]*<\/a[>]/gi); #extract the linked
text.
 
However when I do this, the value of $linkname is always "></a>". I
think this means it does see a linkname in the string, but doesn't
collect what I want.
I've tried several variations on the above, changing "[:alpha:]" to "\w"
adding in "\s*" changing the case of those character definitions.
Thinking my resource could be wrong.
 
I've also tried several things which return errors.
 
I'm also trying to figure out how to collect both the URL and the link
name in one line of code. From what I've read, it looks like it can be
done.
 
The initial goal is to create a list, including the link name, of every
URL on my site.
 
Thanks,
Karl Kittler
 


Reply via email to