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
Characters
Meaning: For a character, it is usually indicated by literal meaning that the character followed by a special character is not interpreted.
For example:/b/matches the character ' B ', which becomes a special character by adding a
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
Escape character Reference:
\a: Beep, Bell
\b: Rewind: back to a grid
\f: Page Change
\ n: newline, the cursor to the beginning of the line
\ r: Enter, the cursor to the beginning of the line
\ t: Horizontal tabulation
\v: Vertical Tabulation
Bitwise operations are operations that are performed in binary order. In system software, it is often necessary to deal with bits problems. The C language provides 6 bit operator operators. These operators can only be used for integer operands, that
1, Python type operator and built-in function summary
Table 4.5 lists all the operators and built-in functions, where the order of the operators is arranged by priority from highest to lowest. Operators of the same gray level have the same priority.
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
Numeric Constants
A numeric constant is what is commonly called a constant. In C + +, numeric constants are type-sensitive, and their types are recognized in literal form.
Type of integer constant (integer)As you know in the previous section:
Usage
int printf (const char *format,[argument]);
Format for the output of the format parameter, defined as:
%[FLAGS][WIDTH][.PERC] [f| N|h|l]type
Specify the mode of data output, as follows:
1.type meanings are as follows:
D signed 10 binary
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
In the computer, everything is encoded by 0 and 1. The computer's operations are only binary, octal, and hexadecimal are just what we people remember to use.
Binary number: is represented by 0 and one. Only for computers.
Decimal number: That is
There are three functions that can convert non-numeric values into numeric values: Number (), parseInt (), and parseFloat (). The first function, that is, the transformation function Number (), can be used for any data type, and the other two
Mixed preg_replace (mixed pattern, mixed replacement, mixed subject [, int limit])FunctionSearches the subject for a match in pattern mode and replaces it with replacement. If limit is specified, only the limit match is replaced, and if the limit is
Every PHP programmer knows that PHP has a strong regular expression function, in order to facilitate future work, I collated the information on the regular expression on the Internet, convenient for later work on the data access.The regular
The complete format of printf format control:
%-0 M. n l or H characters
The following describes the composition formats:
① %: Indicates the starting symbol of the format description, which is indispensable.
②-: "Yes" indicates the left-aligned
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.