Hi, i was searching for a correct url regex, but unsure how would i do it. I am not very expert in regex. So can't be sure that this will always work. I wanted to be able to match even inner urls, such as:
http://google.com
http://www.google.com
http://google.com/something?some=unsome&w=anything
i only wanted to allow http(s) but not gopher or news protocol. Can someone help, please?
$allowed_chars = '[a-zA-Z0-9+._-]';
$protocol = '(http|https)://'
$w3 = "(www.)?";
$subdomain = "{$allowed_chars}*\.?";
$domain = "{$allowed_chars}*\.";
$domain_format "{$allowed_chars}{2,3}";
$country_code = "{$allowed_chars}{2,3}";
$end_parts = "({$allowed_chars}/&:\?)*";