Jump to content

Tiny preg_match_all trouble - match any URL on a domain.


strago

Recommended Posts

preg_match_all('/(www.domain.com\/[a-z0-9-_\.&=:/])\"/i', $html, $matches);

and

 

preg_match_all('/(www.domain.com\/((.*))\"/i', $html, $matches);

 

totally kill it. Only with

 

preg_match_all('/(www.domain.com\/([^"]+))\"/i', $html, $matches);

or

 

preg_match_all('@((https?://)?([-\w]+\.[-\w\.]+)+\w(:\d+)?(/([-\w/_\.]*(\?\S+)?)?)*)@',$html,$matches);

 

can I get it to partly work.

 

Works with static normal URLs, but not something like

 

domain.com/cgi-bin/file.cgi?whatever=whatever&whatever=whatever%2B-more%2B-stuff%2B-is%2B-here%2B-ok

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.