Source Code:
(back to article)
<?php $url = "https://www.example.com"; if (!preg_match("/\b(?:(?:https?|ftp):\/\/|www\.)[-a-z0-9+&@#\/%?=~_|!:,.;]*[-a-z0-9+&@#\/%=~_|]/i", $url)) { echo "Invalid URL format"; } else { echo "Valid URL format"; } ?>
Result:
Report an issue