Php Regular Expression Learning Manual (15 ). The regular expression in the php Tutorial is complete. the manual preface regular expressions are cumbersome, but they are powerful. the application after learning will allow you to improve your efficiency, it will bring you an absolute sense of accomplishment. the regular expression full manual in the php Tutorial
Preface
Regular expressions are cumbersome, but they are powerful. the application after learning will give you an absolute sense of accomplishment in addition to improving your efficiency. As long as you carefully read these materials and make some reference when applying them, it is not a problem to master regular expressions.
Index
1. _ introduction
2. _ regular expression history
3. _ regular expression definition
3.1 _ common characters
3.2 _ non-printable characters
3.3 _ Special characters
3.4 _ qualifier
3.5 _ operator
3.6 _ selection
3.7 _ backward reference
4. _ operation priority of various operators
5. _ all symbolic interpretations
6. _ example
7. _ regular expression matching rules
7.1 _ basic pattern matching
7.2 _ character cluster
7.3 _ confirm repeated occurrence
1. Introduction
At present, regular expressions have been widely used in many software applications, including * nix (linux, unix, etc.), hp and other operating systems, php, c #, java and other development environments, and many applications can see the shadow of regular expressions.
The use of regular expressions can be implemented in a simple way. In order to be simple, effective, and powerful, it makes the regular expression code more difficult and difficult to learn. Therefore, you need to make some effort. after getting started, refer to some references, it is relatively simple and effective to use.
Example: ^. + @. +... + $
Such code has been used to scare me out many times. Many people may be scared away by such code. Continue reading this article to allow you to freely apply such code.
Note: Part 1 here seems to be a bit repetitive, with the aim of re-describing the content in the previous table to make it easier to understand.
2. Regular expression history
The "Ancestor" of regular expressions can be traced back to early studies on how the human nervous system works. Warren mcculloch and walter pitts, two neuroscientists, developed a mathematical method to describe these neural networks.
In 1956, a mathematician named stephen kleene published a paper titled "neural network event representation" based on mcculloch and pitts's early work, introduces the concept of regular expressions. A regular expression is an expression used to describe the algebra of a positive set. Therefore, the regular expression is used.
Later, it was discovered that this work could be applied to some early research on computational search algorithms using the ken thomps tutorial on, where ken thompson was the principal inventor of unix. The First Utility of regular expressions is the qed editor in unix.
As they said, the rest is the well-known history. Since then, regular expressions have been an important part of text-based editors and search tools.
3. Regular expression definition
A regular expression (regular expression) describes a string matching pattern, it can be used to check whether a string contains a seed string, replace matched substrings, or retrieve substrings that meet certain conditions from a string.
In the column Directory, *. txt in dir *. txt or ls *. txt is not a regular expression, because here * is different from the regular expression.
A regular expression is a text mode consisting of common characters (such as characters a to z) and special characters (such as metacharacters. A regular expression is used as a template to match a character pattern with the searched string. 1 2 3 4 5
Regular expressions are cumbersome, but they are powerful. the application after learning will give you an absolute sense of accomplishment in addition to improving your efficiency...