Reputation: 16085
I'm trying to use WWW::Mechanize to extract some links from the HTML page using find_all_links()
method. It supports matching on these criterias:
How can I extract all links except one that has text "xyz"?
Upvotes: 3
Views: 350
Reputation: 1016
Why not get all links then use 'grep' to skip those you don't need?
Upvotes: 1
Reputation: 149823
You can use the 'text_regex'
criteria:
$mech->find_all_links(text_regex => qr/^(?!xyz$).*$/);
See perldoc perlre for more on negative look-ahead assertion.
Upvotes: 6