re.ASCII
The re.ASCII search modifier forces the symbols \w, \W, \b, \B, \d, \D, \s, and \S to rely on ASCII code to find text matches, rather than in Unicode.
The re.ASCII search modifier forces the symbols \w, \W, \b, \B, \d, \D, \s, and \S to rely on ASCII code to find text matches, rather than in Unicode.
The re.DEBUG search modifier displays debug information regarding the function being executed.
The re.IGNORECASE search modifier forces the function to which is applied to perform a case-insensitive search.
The re.split function splits the text string, considering as separator the occurrences of the regular expression pattern.
The re.fullmatch function checks whether the entire text string satisfies the regular expression pattern, returning the corresponding match object. If the regular expression is not found, the function returns None.
The re.match function checks if the regular expression pattern is satisfied at the beginning of the text string, returning the corresponding match object if it is positive. In case of no match, the function returns None.
The re.search function traverses the string searching for the first match of the pattern, returning the corresponding match object. In case of no match found, the function returns None.
The re.compile function creates a regular expression object by compiling a regular expression pattern, which can be used as a matching pattern in the re.match, re.search, etc. functions.
The use of this function makes sense mainly when we want to reuse a search pattern throughout our code, since the previous compilation of the search pattern makes the process more efficient. For example, we can start from the following code that performs a search for the same pattern in two different texts:
The variable string.whitespace returns the text string:
' \t\n\r\x0b\x0c'
That is, it returns all characters considered whitespace, which includes the characters space, tab, linefeed, return, formfeed, and vertical tab.
Excepto donde se indique otra cosa, los contenidos de este sitio web se ofrecen bajo una licencia Reconocimiento-NoComercial-SinObraDerivada 4.0 Internacional