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)

 

相关文章:

  • 2022-01-02
  • 2021-09-24
  • 2021-07-23
  • 2022-12-23
  • 2021-06-03
  • 2022-01-24
  • 2022-12-23
  • 2021-06-16
猜你喜欢
  • 2022-03-05
  • 2022-03-09
  • 2021-07-12
  • 2022-12-23
  • 2022-02-23
  • 2021-06-02
  • 2021-08-23
相关资源
相似解决方案