note 96068 added to function.preg-match

From: Date: Sat, 06 Feb 2010 19:37:32 +0000
Subject: note 96068 added to function.preg-match
Groups: php.notes 
Request: Send a blank email to php-notes+get-165713@lists.php.net to get a copy of this message
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; } ?> ---- Server IP: 69.147.83.197 Probable Submitter: 174.44.156.190 ---- Manual Page -- http://www.php.net/manual/en/function.preg-match.php Edit -- https://master.php.net/note/edit/96068 Del: integrated -- https://master.php.net/note/delete/96068/integrated Del: useless -- https://master.php.net/note/delete/96068/useless Del: bad code -- https://master.php.net/note/delete/96068/bad+code Del: spam -- https://master.php.net/note/delete/96068/spam Del: non-english -- https://master.php.net/note/delete/96068/non-english Del: in docs -- https://master.php.net/note/delete/96068/in+docs Del: other reasons-- https://master.php.net/note/delete/96068 Reject -- https://master.php.net/note/reject/96068 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#165713) next »