So here is what I need to do.
If an user enters this: http://site.com
I need to remove http://
so the string will be site.com
, if an user enters http://www.site.com
I need to remove http://www.
or if the user enters www.site.com
I need to remove www.
or he can also enter site.com
it will be good as well.
I have a function here, but doesn't work how I want to, and I suck at regex.
preg_match('|^http(s)?://[a-z0-9-]+(.[a-z0-9-]+)*(:[0-9]+)?(/.*)?$|i', $_POST['link'])
Can someone please help me?
Best Regards