at the end of your first regex you have:
...(\#[-a-z!//\d_]*)?$/i
Try escaping those slashes: ...(\#[-a-z!\/\/\d_]*)?$/i
ALSO, instead of:
$valid_url="...";
try using apostrophes:
$valid_url='...';
hielo
Veteran Poster
1,124 posts since Dec 2007
Reputation Points: 116
Solved Threads: 244
Another way is not to use the / as the regex delimiter (in PHP). You can use any character, e.g. ~ or %. That way you won't have to escape the slash.
Example:
$valid_protocol = "~^http://|https://~i";
pritaeas
Posting Expert
5,484 posts since Jul 2006
Reputation Points: 653
Solved Threads: 875