Python regular expression

>>> import re
>>> p = re.compile("ab*", _______)
>>> print(p.findall("abAB"))
["ab", "AB"]

what should I fill in the dotted line?

Mar.24,2021

re.I


function definition: re.compile (pattern [, flags])
function: convert regular expression syntax into regular expression object
flags definition includes:
re.I: ignores case
re.L: indicates that the special character set w, W, b, B, s, S depends on the current environment
re.M: multiline mode
re.S:'. 'and any character including a newline character (Note:'. 'excluding newline characters)
re.U: indicates that the special character set w, W, b, B, d, D, s, S depends on the Unicode character attribute database

Menu