Tag: regex

  • Validating a domain string in PHP

    It is not uncommon to need to validate a string passed to a PHP script which purports to be a domain name, or URL. In a past project, I had to validate a domain but without the scheme. This turned out to be much harder that I thought, as the PHP validate filter could only…