The indall function always returns a list of all matching results of the regular expression in the string. Here we mainly discuss the display method of the "results" in the list, that is, findall returns the information contained in each element in the list.
1. When the given regular expression contains multiple brackets, the elements of the list are tuples composed of multiple strings. The number of strings in the tuple is the same as the number of brackets, and the content of the string is the same as the number in each bracket. Regular expressions correspond to each other, and are arranged in the order in which brackets appear.
2. When there is a parentheses in the given regular expression, the elements of the list are strings, and the content of this string corresponds to the regular expression in the parentheses (not the matching content of the entire regular expression).
3. When the regular expression is given without parentheses, the elements of the list are strings, and this string is the content matched by the entire regular expression.
All resources on this website are contributed and published by netizens, or reprinted by major download sites. Please check the integrity of the software yourself! All resources on this website are for learning and reference only. Please do not use them for commercial purposes, otherwise you will be responsible for all consequences incurred! If there is any infringement, please contact us to delete and remove it. Contact information: admin@php.cn