Regular Expression Basics

Source: Internet
Author: User

1. \b Represents the beginning or end of a word. Such as: \bhi\b represents a perfect match for the Hi Word

2. * represents any character that matches except newline characters.

. * Together, any number of characters without a newline character

For example: \bhi\b.*\blucy\b represents the first a hi word followed by any character (except for newline characters), finally Lucy ends the string.

3, \d match a number (0-9 of a number)

For example: 0\d{2}-\d{8} represents 0, followed by two digit connectors-the number after a 8

4, \s match any white space symbol (Space, tab, line break, Chinese full-width space)

5. \w matches letters or numbers or underscores or kanji

6. ^ Match string start

7, $ match string end

8, \d+ match 1 or more numbers

\d* matches any number, possibly 0 digits

9, ^\d{5,12}$ represents 5-12 digits

10. Transfer characters, find special words such as * + \. When special characters are added, the front plus \

such as: unibetter\.com matching unibetter.com

C:\\Windows matching C:\Windows

11. Repetition

such as * Repeat 0 or more times

+ Repeat one more time including once

? Repeat 0 or 1 times.

{n} repeats n times

{n,} repeats n or more times

{N,m} repeats n to M times

Regular Expression Basics

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.