in reply to How can I handle special characters in mech->find_link
Your regex doesn't work because your string $PrevMsgLink contains characters that are special in regular expressions, notably the pair of parentheses. You can use \Q...\E to prevent those chars from being interpreted as regular expression special characters:
my $topic_obj = $mech->find_link (text_regex => qr/\Q$PrevMsgLink\E/i +) or die "Didn't find anyhting matching '$PrevMsgLink' in the page!" +;
But what you really should do instead of scraping the eBay website is to use the Net::eBay API, which gives you fast, robust and convenient access to all of eBay, within the limits of the eBay Terms of Use.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How can I handle special characters in mech->find_link
by SpacemanSpiff (Sexton) on Jun 12, 2006 at 08:17 UTC |