"Fossies" - the Fresh Open Source Software Archive

Member "sarg-2.4.0/sarg-php/url_validator.php.inc" (4 Sep 2017, 281 Bytes) of package /linux/privat/sarg-2.4.0.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) fasm source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 <?php
    2 
    3 function check_url($url)
    4 {
    5     /*
    6         Regex is @gruber as found at https://mathiasbynens.be/demo/url-regex
    7 
    8         Thanks Mathias for sharing those regex in a clear table.
    9      */
   10     return(preg_match("#\b(([\w-]+://?|www[.])[^\s()<>]+(?:\([\w\d]+\)|([^[:punct:]\s]|/)))#i", $url)===1);
   11 }