You are not logged in.
Login or Register

Tip: Regular Expression to Validate a URL

Posted By: apeiro

This regular expression can validate most HTTP/FTP URLs

Ta da.

<?php
    $is_valid = preg_match('@((ht|f)tps?://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)?)@', $url);
?>