Perl regular expression-1

Source: Internet
Author: User
Tags perl regular expression

. Represents any single character and does not match the linefeed.
* Is A quantizer, indicating that the previous content appears 0 to multiple times.
+ It is also a quantizer, indicating that the previous content appears one to multiple times.

Character Set abbreviation
\ D indicates a number
\ W represents a word character () number, letter, underline)
\ S indicates a blank space. It can match line breaks, tabs, page breaks, carriage returns, and spaces.
\ D indicates that a non-number is equivalent to [^ \ D]
\ W indicates that a non-word character is equivalent to [^ \ W]
\ S indicates that a non-blank character is equivalent to [^ \ s]

Modifier of Perl Regular Expression
/I indicates case-insensitive, such as/Yes/I matching
/S can be used to modify. (any non-wrap single character), so that. line breaks can be matched, for example,/. b/S can match a \ Nb, which is modified by/s. equivalent to [\ D]
/X causes the blank spaces (spaces or tabs) in the mode to be ignored during mode matching, for example /-? \ D */X matches 0 or 1 minus sign followed by 0 to multiple numbers

Character Anchorage
^ Indicates the starting position of the modifier./^ Fred/matches only strings starting with Fred.
$ Specifies the delimiter of a character./Fred $/matches only strings ending with Fred.

Related Article

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.