python basis | Module --- re module

  The python re module is the technology applied. For regular is regular expressions, regular expressions is an independent technology in various programming system has its "shadow." In python reptile in technology, data analysis, it is essential to existence. The main use of regular expressions filter string data type string we need.

  Regular expressions basics. Metacharacters and quantifiers.

Metacharacters

Match action

.

You can match any character except newline

\w

Match letters, numbers and declining line

\d

In addition to matching digital

\s

Matching spaces

\W

Non-match letters, numbers and underscores

\D

Matching non-numeric

\S

Matching non-space

^

^ Matches the beginning of the string. Usage (^ a: at the beginning of a string matching)

$

$ Matches the end of the string. Usage (a $: end of the string a)

\n

Newline

\t

A matching tab

\b

Matching words ending

()

Matching expression in parentheses, also represents a group

[…]

Matches the character set of characters

[^….]

Matches all characters except the characters in the group

a|b

Matching character a or b

Guess you like

Origin www.cnblogs.com/huaiXin/p/11201825.html