Daily Archives: March 10, 2009

validate http:// or https:// using regex

Share You can validate http:// or https:// using the methods below: $link = “http://site.com”;  or $link = “https://site.com”; Example: My values would be either of the two, with or without “s”. Method 1: echo preg_match(“^(http(s?))://^”, $link); I prefer this method … Continue reading

Posted in regex | Tagged , , , | Leave a comment