python 捕获分组(xxx)与非捕获分组(?:xxx)

findall 的捕获分组与非捕获分组

# -*- coding:utf-8 -*
import re
str1 = 'fdg@163.com  abc@qq.com'
reg_str1=r'([0-9a-zA-Z_]+)+@'# 打印结果 ['fdg', 'abc']
#reg_str1=r'(?:[0-9a-zA-Z_]+)+@'# 打印结果 ['fdg@', 'abc@']
mod = re.compile(reg_str1)
items = mod.findall(str1)
print(items)
原文地址:https://www.cnblogs.com/taoyuanming/p/12306950.html