in reply to extracting link *and* tag content from "a href"
#!/usr/bin/perl while(<DATA>) { m#<A.*?HREF=(?:'|")?(.[^\'\"]+)(?:'|")?(?:\s.+)?>(.*?)</A>#ig; print "URL: $1\nName: $2\n\n"; } __END__ <A HREF=?ad=049>One</A> <A HREF=?ad=050>Two</A> <a target='_new' href='foo'>foo --> bar</a> <a target='_new' href='boo'>blah</a> <a target='_new' href=bar>troz</a> <a target='_new' href=bar2 onclick='somefunc'>troz</a> <a target='_new' href='bar3' onclick='somefunc'>troz</a>
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: extracting link *and* tag content from "a href"
by BUU (Prior) on Jul 19, 2004 at 20:24 UTC | |
by bageler (Hermit) on Jul 19, 2004 at 20:33 UTC | |
by BUU (Prior) on Jul 19, 2004 at 20:41 UTC | |
by iburrell (Chaplain) on Jul 20, 2004 at 16:49 UTC |