【Python-lib】 re

2022-05-31  本文已影响0人  盐果儿

Introduction:

The 're' package provides several methods to actually perform queries on an input string.

Methods:

re. match(pattern, string): Search the regular expression pattern and return the first occurrence. [Checks for a match only at the beginning of the string.] (If a match is found in the first line, it returns the match object, else, returns null.)

re. search(pattern, string): Search the regular expression pattern and return the first occurrence. [Checks all lines of the input string.]

re. findall(pattern, string): search for all occurrences that match a given pattern.

Reference:

https://www.guru99.com/python-regular-expressions-complete-tutorial.html

上一篇 下一篇

猜你喜欢

热点阅读