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/);
In reply to Negate link search in Mechanize by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |