美文网首页
【Python-lib】 re

【Python-lib】 re

作者: 盐果儿 | 来源:发表于2022-05-31 23:25 被阅读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

相关文章

网友评论

      本文标题:【Python-lib】 re

      本文链接:https://www.haomeiwen.com/subject/snstmrtx.html