// Perl regular expression perl is an extra extended \ d number \ D non-digit \ s blank \ S non-blank \ w letter mathematical symbol underline \ W non-letter number on the basis of posix underline
Echo"
";
// \ B indicates the word boundary
If (preg_match ("/\ bweb \ B/I", "PHP is the web scripting language of choice .")){
Print "A match was found .";
} Else {
Print "A match was not found .";
}
If (preg_match ("/\ bweb \ B/I", "PHP is the website scripting language of choice .")){
Print "A match was found .";
} Else {
Print "A match was not found .";
}
// Especially when matching email addresses
Echo"
";
$ Pattern6 = "/world /";
$ Content2 = "girl ";
$ Tre = "hello world ";
Echo preg_replace ($ pattern6, $ content2, $ tre );
// String preg_quote (string str [, string delimiter]) escape
Echo"
";
$ Keywords = "$40 for a g3/400 ";
$ Keywords = preg_quote ($ keywords, "/"); // if this field is not added, it will not escape/in g3/400 /;
Echo $ keywords;
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service