Php Regular Expression Learning Manual (1/5)

Source: Internet
Author: User
Tags manual php regular expression printable characters

Full manual on regular expressions in php tutorials

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.

Homepage 1 2 3 4 5 Last page

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.