Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/308.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 验证字符串上的正则表达式字符串数组_Python_Regex_Django - Fatal编程技术网

Python 验证字符串上的正则表达式字符串数组

Python 验证字符串上的正则表达式字符串数组,python,regex,django,Python,Regex,Django,我有一个要应用于字符串的正则表达式数组 regexString = "'\d{2,}';'..'" regexPatterns = regexString.split(";") regexPatterns = ["'\d{2,}'","'..'"] 如何有效地使用该列表并仅在所有正则表达式都找到匹配项时进行匹配?您可以使用内置函数: isgood = all(re.search(regex, s) for regex in regexPatterns) 您可以使用内置功能: isgood =

我有一个要应用于字符串的正则表达式数组

regexString = "'\d{2,}';'..'"
regexPatterns = regexString.split(";")
regexPatterns = ["'\d{2,}'","'..'"]

如何有效地使用该列表并仅在所有正则表达式都找到匹配项时进行匹配?

您可以使用内置函数:

isgood = all(re.search(regex, s) for regex in regexPatterns)

您可以使用内置功能:

isgood = all(re.search(regex, s) for regex in regexPatterns)