SymbolA regular expression consists of a set of ordinary characters and metacharacters.Ordinary characters include numbers and uppercase and lowercase letters.Meta-character Description\ marks the next character as a special character, or a literal
A regular expression is a logical formula for a string operation, which is a "rule string" that is used to express a filter logic for a string, using predefined specific characters and combinations of these specific characters.The given characters
Regular expression syntax
A regular expression is a literal pattern consisting of ordinary characters (such as characters A through Z) and special characters (called metacharacters ). This pattern describes one or more strings to be matched when
Objective
Regular expression is cumbersome, but powerful, after the application of learning will let you in addition to improve efficiency, will give you a sense of absolute achievement. As long as the careful reading of these materials, coupled
The data that needs to be processed by our program is not always designed in advance by database thinking, or it cannot be stored with the structure of the database.
For example, template engine parsing template, garbage sensitive information
Copy Code code as follows:
(?:p Attern) matches pattern but does not get matching results, which means that this is a non fetch match and is not stored for later use. This is useful for combining parts of a pattern with the "or" character (|
The article to share the PHP regular Expression Security Tutorial Foundation, this article will continue to extend the knowledge of PHP regular expressions, see below for details.
Operation Precedence for various operators of PHP regular
Regular Expressions Learning Notes
A regular expression (regular expression) describes a pattern of string matching that can be used to check whether a string contains
There is a seed string, a matching substring is substituted, or a substring is
Here are some examples of regular expressions that you might encounter:
/^\[\t]*$/"^\[\t]*$" matches a blank line.
/\d{2}-\d{5}/"\d{2}-\d{5}" verifies that an ID number consists of a 2-bit character, a hyphen, and a 5-digit number.
/.*/".*" matches
Only numbers can be entered: "^[0-9]*$".Only n digits can be entered: "^\d{n}$".You can enter at least n digits: "^\d{n,}$".You can enter only the number of m~n digits:. "^\d{m,n}$"Only numbers beginning with 0 and not 0 can be entered: ^ (0|[ 1-9][0
When to use regular expressions.
In the process of program development, it is often necessary to perform the matching, searching, extracting, replacing and judging of the text content repeatedly. If the individual only use code to achieve the
Regular
The early origins of regular expressions
The "ancestors" of regular expressions can be traced back to early studies of how the human nervous system works. Warren McCulloch and Walter Pitts, two neuroscientists, have developed a mathematical
Regular
\Marks the next character as a special character, or a literal character, or a back reference, or a octal escape character. For example, ' n ' matches the character ' n '. ' \ n ' matches a newline character. Sequence ' \ ' matches ' \ ' and
Tutorials | It's good to learn regular expressions recently and see this article.
PrefaceRegular expression is cumbersome, but powerful, after the application of learning will let you in addition to improve efficiency, will give you a sense of
What is a regular expression?If you have never used a regular expression, you may not be familiar with this term or concept. However, they are not as novel as you think.Remember how to find files on the hard disk. Are you sure you want to use? And *
A regular expression is a text mode consisting of common characters (such as characters A to Z) and special characters (such as metacharacters. This mode describes one or more strings to be matched when searching the text subject. A regular
The following table shows a complete list of metacharacters and their behaviors in the context of a regular expression:
Character
Description
\
Mark the next character as a special character, a literal character, a
A regular expression is a text mode consisting of common characters (such as characters a to z) and special characters (such as metacharacters. This mode describes one or more strings to be matched when searching the text subject. A regular
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.