What are the Python regular expression modifiers
Today, I would like to share with you the relevant knowledge points of Python regular expression modifiers, which are detailed in content and clear in logic. I believe most people still know too much about this knowledge, so share this article for your reference. I hope you can get something after reading this article.
Regular expression object re.RegexObject
Re.compile () returns a RegexObject object.
Re.MatchObject
Group () returns the string matched by RE.
Start () returns the position where the match starts
End () returns the position where the match ends
Span () returns a tuple containing the location of the match (start, end)
Regular expression modifier-optional Fla
Regular expressions can contain optional flag modifiers to control matching patterns. The modifier is specified as an optional flag. Multiple flags can be specified by bitwise OR (|) them. For example, re.I | re.M is set to I and M flags:
The modifier describes re.I to make the match case-insensitive re.L to do localized recognition (locale-aware) matching re.M multiline matching, affecting ^ and $re.S to make. Matches all characters, including line breaks. Re.U parses characters according to the Unicode character set. This flag affects\ w,\ W,\ b,\ B.re.X this flag allows you to write regular expressions more easily by giving you more flexible format. That's all of the article "what are the Python regular expression modifiers?" Thank you for reading! I believe you will gain a lot after reading this article. The editor will update different knowledge for you every day. If you want to learn more knowledge, please pay attention to the industry information channel.