Menu

PHPCrawl Regular Expressions.

Help
Anonymous
2015-11-12
2016-09-03
  • Anonymous

    Anonymous - 2015-11-12

    It seems to me, that an URI/URL and his literal, with scape markers, shoud match.
    But it doesn't work, maybe its something wrong.

    URL I want to match: http://www.1000bebes.com/silla-de-auto-pallas-m-fix-2015.html
    RegExp i use: (http:\/\/www.1000bebes.com\/silla-de-auto-pallas-m-fix-2015.html)

    ps: I use this RegExp, in PHPCrawl::addURLFilterRule() and I also use a RegExp in PHPCrawl::addURLFollowRule(). The last want works.

    Thanky ou very much in advance.

    Blessings, M.

     
  • James Shaver

    James Shaver - 2016-09-03

    Try this:

    $url = "http://www.1000bebes.com/silla-de-auto-pallas-m-fix-2015.html";
    // preg_quote escapes the dot, question mark and equals sign in the URL (by
    // default) as well as all the forward slashes (because we pass '/' as the
    // $delimiter argument).
     $escapedUrl = preg_quote($url, '/');
    // We enclose our regex in '/' characters here - the same delimiter we passed
    // to preg_quote
    $regex = '/\s' . $escapedUrl . '\s/';
    // Add the $regex to the filter
     $crawler->addURLFilterRule($regex);
    
     

Anonymous
Anonymous

Add attachments
Cancel





Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.