including slash inside group
Posted: Sat Sep 03, 2005 9:47 pm
using this pattern
preg_match_all("|http[://]+[A-Za-z0-9_.-]+|", $contents , $matches);
for string
http://some-domain-name.com
gives the result http://some-domain-name.com
however, if I include a slash, whether by itself or escaped
preg_match_all("|http[://]+[A-Za-z0-9_.-/]+|", $contents , $matches);
or
preg_match_all("|http[://]+[A-Za-z0-9_.-\/]+|", $contents , $matches);
I get the result
http://some
How do I include slashes?
preg_match_all("|http[://]+[A-Za-z0-9_.-]+|", $contents , $matches);
for string
http://some-domain-name.com
gives the result http://some-domain-name.com
however, if I include a slash, whether by itself or escaped
preg_match_all("|http[://]+[A-Za-z0-9_.-/]+|", $contents , $matches);
or
preg_match_all("|http[://]+[A-Za-z0-9_.-\/]+|", $contents , $matches);
I get the result
http://some
How do I include slashes?