Regular express...LOGIN

Regular expressions in PHP

We often say this:

The most difficult things to understand in the world are Taoist priests’ ghost charms and doctors’ prescriptions

In fact, we still need Add a sentence:

The most difficult things in the world to understand are Taoist priests' ghost symbols, doctors' prescriptions and programmers' regular expressions.

Let’s first look at what a regular expression looks like:

/^a-z@([a-z0-9][-_]?[a-z0-9]+)+[.][a-z]{2,3}([.][a-z]{2})?$/i

Haha, I feel heartbroken just looking at it. Let me state in advance, don’t be intimidated, you will find that it is not that difficult after you study it.

Regular expression means we have seen it often before. It is mainly used in the following places:

  1. Matching email, mobile phone number, verification code
  2. Replace sensitive Key words. For example: Collection of articles involving politics and swearing words
  3. .
  4. Early expression replacement technology, UBB file encoding, markdown editor replacement, etc.
  5. In the future, you will also need to use regular expression expressions when writing your own template engines
    Others....

Let’s study this chapter and first learn and understand the basic techniques that regular expressions need to master bit by bit.

Next Section
submitReset Code
ChapterCourseware