Php getting started Knowledge Point 4: Basic application of PHP regular expressions. Copy the code as follows :? Php regular expression ereg case sensitive if (ereg ([A-Z] {3,}), AAA) {echo uppercase can match! Br;} else {echono;} if (ereg ([A-Z] {3,}),
The code is as follows:
// Regular expression
// Ereg case sensitive
If (ereg ("([A-Z] {3,})", "AAA ")){
Echo "matches in uppercase!
";
} Else {
Echo "no ";
}
If (ereg ("([A-Z] {3,})", "aaa ")){
Echo "yes ";
} Else {
Echo "lowercase letters cannot match!
";
}
// Eregi is case insensitive
If (eregi ("([A-Z] {3,})", "Aaaa ")){
Echo "can all be matched in uppercase and lowercase! ";
}
// Return the matched value
If (ereg ("^ (0 [0-9] {2, 3})-([0-9] {7, 8})", "0592-5337138", $ regs )) {
Echo "return value 0 subscript is original string $ regs [0]
";
Echo "return area code (the first matching string)". $ regs [1]."
";
Echo ("Return phone number (second matching string) $ regs [2]
");
}
?>
Getting started with regular expressions in 30 minutes
Basic regular expressions
The http://www.bkjia.com/PHPjc/323829.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/323829.htmlTechArticle code is as follows :? Php // regular expression // ereg case sensitive if (ereg ("([A-Z] {3,})", "AAA") {echo "uppercase matching! Br ";} else {echo" no ";} if (ereg (" ([A-Z] {3,}) ","...