Possible Duplicate:
Troubleshooting “preg_replace(): Unknown modifier”
My pattern for detecting the URL is: \b[(http://|https://)]*[www]*[\.]*(\S+\.[a-z]{2,})/*
while my replacement pattern is \1\2
. It's not seemingly working, however, as I get this error:
Warning: preg_replace(): Unknown modifier '/' in [...][...] on line 1
What am I doing wrong?
Also, if someone could mention how to detect the fact a URL could have multiple periods in it for subdomains (like name.subdomain.canada.gov) how would I detect that infinitely? I know I could have \S*\.*
but isn't that like "there could be another set of subdomains and another period, but not necessarily" what if there's another sequence of five more subdomains?
My actual usage would be: preg_replace("\b[(http://|https://)]*[www]*[\.]*(\S+\.[a-z]{2,})/*", "\1\2", $text);