Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I am trying to scrape some links using Mechanize and cannot find a way to negate the search argument. I need to find links that do not contain (for example) 'foo'. Tried super search, perlre & Mechanize docs with no help, but feel like I'm overlooking something obvious. Can anyone help?
# this finds the links I do not want: my @links = $mech->find_all_links(url_regex => qr/foo/); # these (as well as some really bizarre attempts) don't work: my @links = $mech->find_all_links(url_regex => !qr/foo/); my @links = $mech->find_all_links(url_regex !~ qr/foo/);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Negate link search in Mechanize
by Plankton (Vicar) on Nov 02, 2011 at 05:04 UTC | |
by Anonymous Monk on Nov 02, 2011 at 05:18 UTC | |
|
Re: Negate link search in Mechanize
by mwp (Hermit) on Nov 02, 2011 at 04:57 UTC | |
|
Re: Negate link search in Mechanize
by Anonymous Monk on Nov 02, 2011 at 13:34 UTC |