In essence, a regular expression (or RE) is a small, highly specialized programming language (in Python) that is embedded in Python and implemented through the RE module. The regular expression pattern is compiled into a sequence of bytecode, which is then executed by a matching engine written in C.
Character match (normal character, metacharacters):
1 Ordinary characters: Most characters and letters will match themselves
>>> Re.findall (' Alvin ', ' Yuanalesxalexwupeiqi ')
[' Alvin ']
2 meta characters:. ^ $ * + ? { } [ ] | () \ #共11个元字符
def findall (pattern, string, flags=0): "" "Return A list of all non-overlapping Matches in the string. If one or more capturing groups is present in the pattern, return a list of groups; This would be a list of tuples if The pattern has more than one group. Empty matches is included in the result. """ return _compile (pattern, flags). FindAll (String)
FindAll Sword Spectrum
Re.findall (pattern,string) #找到所有的匹配元素, return to list
(1). : matches any symbol except \ n
Print (Re.findall ("A.+d", "ABCD"))
Python basic re module