Discover regular expression tutorial, include the articles, news, trends, analysis and practical advice about regular expression tutorial on alibabacloud.com
PHPPerl-style regular expressions 1. regular expressions, as a matching template, are composed of atoms (common characters, such as a-z) and have special functions (metacharacters, for example, *, +, and? And the pattern modifier.
2. when using a pattern in Perl-compatible regular expression functions, you must add a s
modifierA regular may contain a modifier that can affect search results.There are 3 modifiers in JS:g: Find all results;I: result ignoring case;m: Multi-line matching mode;Modifier is placed after the parameter, such as:/.../g.A regular with no global modifier returns only the first matching value:1 alert ("123". Match (/\d/)) // ' 1 'If there is a global modifier, all matching values will be returned:1 a
PHP Regular Expression special characters "[]" and "", then what are they? What is the specific operation? They are special characters, so what is the special place in the use process? Let's take a look at the specific introduction.
There are also two very important special characters that are "[]". They can match the characters that appear in "[]", such as "/[az]/" can match a single character "a" or "Z",
Qualifier
Sometimes you don't know how many characters to match. To accommodate this uncertainty, regular expressions support the concept of qualifiers. These qualifiers can specify how many times a given component of a regular expression must appear to satisfy a match.
The following table gives a description of the various qualifiers and their meanings:
This article not only to tell about the regular Tatsu and also about the composition of the mailbox is the use of a detailed explanation, there is a need to understand the friend can refer to, at the same time we also provide a variety of different mailbox verification examples.
Regular expression.
The code is as follows
Copy Code
^[_.
The regular expression that we all call now basically refers to a Perl-style regular expression. POSIX-style regular expressions are basically no one to use, so from PHP5.3, it is deprecated, probably to the next version of PHP will be the relevant function deleted.
About
Analysis of PHP regular expression positioning characters. We often encounter the use of PHP regular expressions to locate characters during development. what types of characters does a PHP regular expression have? What exactly do they mean when we use PHP
PHP function Preg_match_all The specific use of the method we canPHP function Preg_match_all Instance requirements: Separate the ID and content of each div element, such as biuuu,biuuu_2,biuuu_3,php self-study nets, PHP self-learning Nets 2 and PHP self-study Network 3 (some of the commonly used method of grasping the station is such a match)
Analysis: string is a simple HTML element, each DIV element pair should be an ID and content, and is independent, first of all, consider how to take out a
This article introduced the use of PHP regular expression to extract the image address hyperlink title Implementation code, there is a need for friends to refer to.
The regular expression extracts the id in the URL
The code is as follows
Copy Code
Preg_match ('/http://t.sina.com.cn/(d+)/fans
In PHP, the string length of the regular expression matching of the preg_match function is incorrect. In PHP, the preg_match function is used for regular expression matching of the string length. This article mainly introduces the regular
Php regular expression verification date and time format instance code. Using php to verify the date format, we can use the checkdate () function and regular expression to verify the format. next I will introduce some of my processes in verifying the date format, finally, we can use php to verify the date format. we ca
The regular expression of the IP address. The following are two instances of the ip address regular expression. the instance verifies multiple IP addresses and prints out valid ip addresses. The following is an example of two regular expressions for ip addresses. the instanc
2. the historical "Ancestor" of a regular expression can be traced back to an early study of how the human nervous system works. The two neuroscientists WarrenMcCulloch and WalterPitts have developed a mathematical method to describe these neural networks. In 1956, a number named Stephen Kleene SyntaxHighlig
2. Regular expre
I haven't encountered a PHP problem for a long time. This Regex problem takes a little time, and it is still the biggest backtracking and recursive restriction problem of the old problem. It is not difficult to modify the regular expressions with such problems after the learning is done. The main points are as follows. The template engine based on regular expression
It's been a long time since I've had a problem with PHP, and this is a bit of an issue, and it's the biggest retrospective and recursive limitation of old problems. After learning it is not difficult to modify debugging has such a problem. Mainly the following points.
A template engine that is based on regular expression substitution can easily meet the maximum backtracking/recursion restrictions for
Explain the example code of PHP regular expression multi-line matching. In the course of study, many problems need to be solved continuously in practice. When matching PHP regular expressions, we only use regular expression functions under POSIX, which is difficult to learn.
The correct PHP matches the regular expression of UTF-8 Chinese. Correct PHP matching UTF-8 Chinese regular expression this article mainly introduces the correct PHP matching UTF-8 Chinese regular expression, this paper gives two
Php regular expression suffix. Perl-style regular expressions allow you to place a single character option (flag) behind the regular expression mode to modify the matching interpretation or behavior. For example, to perform case-insensitive matching, a Perl-style
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.