note 50024 added to function.ereg

From: Date: Wed, 16 Feb 2005 00:02:42 +0000
Subject: note 50024 added to function.ereg
Groups: php.notes 
Request: Send a blank email to php-notes+get-85088@lists.php.net to get a copy of this message
This took me a little to find out, but from one PHP/Regex newb to another if your trying to let people use Square Brackets in a string: [ ] Like in this string for example: ^[a-zA-Z0-9]{1,}$ This following will most likely not work (You can't backslash them): ^[a-zA-Z0-9\[\]]{1,}$ So, to escape the Square Brackets, use the following to delimit collating symbols: [. Special Character Goes Here .] So The New Expression: ^[a-zA-Z0-9 [.[.] [.].] ]{1,}$ (I spaced it so it was less confusing) ---- Manual Page -- http://www.php.net/manual/en/function.ereg.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+50024 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+50024&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+50024&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+50024&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+50024&report=yes&reason=useless Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+50024&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+50024&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#85088) next »