note 18135 added to function.ereg

From: Date: Fri, 11 Jan 2002 16:51:22 +0000
Subject: note 18135 added to function.ereg
Groups: php.notes 
Request: Send a blank email to php-notes+get-24675@lists.php.net to get a copy of this message
I must've read 50 regular expression tutorials and understood nothing from each. I finally worked them out through playing around and looking at other people's examples. I wrote this to summarise and clarify things. I find it helps as a quick lookup reference: ^ Start of String $ End of string n* Zero or more of 'n' n+ One or more of 'n' n? A possible 'n' n{2} Exactly two of 'n' n{2,} At least 2 or more of 'n' n{2,4} From 2 to 4 of 'n' () Parenthesis to group expressions (n|a) Either 'n' or 'a' . Any single character [1-6] A number between 1 and 6 [c-h] A lower case character between c and h [D-M] An upper case character between D and M [^a-z] Absence of lower case a to z [_a-zA-Z] An underscore or any letter of the alphabet ^.{2}[a-z]{1,2}_?[0-9]*([1-6]|[a-f])[^1-9]{2}a+$ A string beginning with any two characters Followed by either 1 or 2 lower case alphabet letters Followed by an optional underscore Followed by zero or more digits Followed by either a number between 1 and 6 or a character between a and f (Lowercase) Followed by a two characters which are not digits between 1 and 9 Followed by one or more n characters at the end of a string -- http://www.php.net/manual/en/function.ereg.php http://master.php.net/manage/user-notes.php?action=edit+18135 http://master.php.net/manage/user-notes.php?action=delete+18135 http://master.php.net/manage/user-notes.php?action=reject+18135

« previous php.notes (#24675) next »