C # Second article--about regular expressions in C #

Source: Internet
Author: User

In C #, a regular expression is a tool used to query certain characters or numbers in a string of characters given. Similar to the search function in office software, you can find it with precision or with a fuzzy look.

Metacharacters

Metacharacters

Description

.

Match any character other than line break

\b

Match the beginning or end of a word

\d

Match numbers

\s

Match any of the whitespace characters

\w

Match letters or numbers or underscores or kanji

^

Match the start of a string

$

Match the end of a string

Qualifier:

Qualifier

Description

*

Repeat 0 or more times

+

Repeat one or more times

?

Repeat 0 or one time

N

Repeat n times

{N,}

Repeat N or more times

{N,m}

Repeat N to M times

Assertion:

Assertion syntax

Description

(? =pattern)

Forward positive assertion that matches the position in front of the pattern

(?! Pattern

Forward negative assertion that matches a position not followed by pattern

(? <=pattern)

Back-to-positive assertion that matches the position behind the pattern

(? <!pattern)

Back to negative assertion, matching the position of the previous not pattern

C # Second article--about regular expressions in C #

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.