PHP Regular Expressions-basics

Source: Internet
Author: User
Tags alphabetic character

POSIX style

. at

Can match cat sat mat #at点可以匹配任意字符 [A-z]at [A-za-z]Match a collection class in square brackets [^a-z]Represents a character that is not part of the collection * means that it can be repeated 0 or more times + indicates that it can be repeated 1 or more times [[: alnum:]]+Indicates that there is at least one alphabetic character ()Parentheses are used to split sub-expressions (very) *large can match very large, very very large, large {}The curly braces indicate that the number of repetitions allowed {3} is repeated 3 times, {2,4} means repeating the first four times, {2,} representing at least 2 repetitions ^bob representing a string at the beginning of the string that matches Bob com$ that matches a COM ^[a-za-z]$ at the end of the string that matches only one alphabetic character Use a vertical bar to denote branch selection com|edu|net means that when a COM or edu or net Match Special character is matched, a backslash \ is used to escape, and it needs to be escaped again in PHP. Match e-mail address^[a-za-z0-9_\-.] [Email protected] [A-za-z0-9\-]+\. [a-za-z0-9\-.] +$ the regular lookup stringEreg (string pattern, string search, array [matches]); Eregi case insensitive Regular Replacement stringString ereg_replace (string pattern, string replacement, string search); Regular split stringArray split (string pattern, string search [, int max]);

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.