Python Regular Expression re
Import rere. the compile () function is used to compile the regular expression string form into a Pattern instance, and then use the Pattern instance to process the text and obtain the matching result m = re. search (pattern, string) # search the entire string until the matching sub-string m = re is found. match (pattern, string) # Check whether the string conforms to the regular expression from the beginning. The returned m must start with the first character of the string. We use m. group () to call the result. M. group (number) method to query a group. Group (0) is the search result of the entire regular expression, and group (1) is the first group ...... Re. split () # split the string according to the regular expression, put all the substrings after the split in a table (list), and return re. findall () # search for a string based on a regular expression, and put all matching substrings in a list to return the re. S # indicates multi-row matching, using re. after the S parameter, the regular expression matches the string as a whole.