A brief analysis of PHP regular expression positioning character _php tutorial

Source: Internet
Author: User
Tags php regular expression
The use of the PHP regular expression positioning characters is often encountered during the development process, then the specific type of PHP regular expression positioning characters have what? What exactly do they represent? Let's start by introducing each.

The role of the PHP regular expression positioning character:

The PHP regular expression positioning character is a very important type of character in the PHP regular expression, and its main function is to describe the position of the character in the matching object.

The type and meaning of the PHP regular expression positioning character:

^:

Indicates that the matching pattern appears at the beginning of the matching object (and differs in "[]")

$:

Indicates that the matching pattern appears at the end of the matching object

Spaces

Represents one of the two boundaries that match the pattern that is now starting and ending

"/^he/":

You can match a string that begins with the "he" character, such as Hello, height, and so on;

"/he$/":

You can match the string that ends with the "he" character, she, and so on;

"/he/":

The space begins with the function of ^, matching the string that begins with the He;

"/he/":

The space ends, and the function of $, matches the string ending with the He;

"/^he$/":

Indicates that only the string "he" matches.

The simple introduction of the PHP regular expression positioning character tells you here that it is helpful to understand and master the PHP regular expression positioning characters.


http://www.bkjia.com/PHPjc/446589.html www.bkjia.com true http://www.bkjia.com/PHPjc/446589.html techarticle The use of the PHP regular expression Positioning characters is often encountered during the development process, then the specific type of PHP regular expression positioning characters have what? What they specifically represent ...

  • 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.