Get the App
SLTechnology News&Howtos  ›  Development  › 

How to use the question mark of regular expression in python

Shulou Source: shulou.com Published: 2022-06-03 17:34:07 10月03日 Update

This article mainly introduces the python regular expression question mark how to use, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to understand it.

1. Declaration and non-greedy matching.

2. Represents an optional grouping. Match zero or more times with asterisks, one or more times with plus signs, specific times with curly braces, greedy and non-greedy matches.

Example

Import re a = 'wxxIxxeuieiejfsdjxxlovexxfsiewiweirxxUxxwuerowiur'b = re.findall (' xx (. *?) xx', a) print (b) print (type (b)) for item in b:print (item)

Output

IloveU thanks you for reading this article carefully. I hope the article "how to use question marks in regular expressions in python" shared by the editor will be helpful to you. At the same time, I hope you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

Tags: Articles rules expressions question marks greed value interest plus sign at the same time examples parentheses asterisks more friends times knowledge editing industry information information channels Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno OPPO Reno Apple Microsoft MySQL vpn