note 96068 deleted from function.preg-match by danbrown
| From: | danbrown@php.net | Date: | Sat, 06 Feb 2010 20:04:44 +0000 |
| Subject: | note 96068 deleted from function.preg-match by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-165715@lists.php.net to get a copy of this message | ||
Note Submitter: darkain at darkain dot com
----
In reply to: splattermania at freenet dot de
To validate a URL, the preg_match should be done in a case-insensitive form. This messed me up for
quite a while until I figured out that a capitol letter in a URL is what was breaking the
validation.
Please note the letter 'i' at the end of the regex to force it to be case-insensitive.
<?php
if(preg_match("/^$regex$/i", $url))
{
return true;
}
?>