Professional Documents
Culture Documents
EXPRESSIONS
$ZIP = "01562";
preg_match("/...../", $ZIP); //
“of despair$” Matches a string that ends in the substring “of depair
“abc$” A string that starts and ends with “abc” – that could only
be “abc” itself!
$URL = "http://www.dongosselin.com";
preg_match("/^https?/", $URL); //
$Name = "Don";
preg_match("/.+/", $Name); //
NumberString = "00125";
preg_match("/^0*/", $NumberString);//
1 (707) 555-1234
preg_match("/^(1 )?(\(.{3}\)
)?(.{3})(\.{4})$/
preg_match("/analy[sz]e/", "analyce");//
$LetterGrade = “A";
echo ereg("[A-DF]", $LetterGrade);