且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用正则表达式从文本中提取单词和逗号之间的名称

更新时间:2022-11-14 23:18:23

使用模式([^,]*)将所有内容匹配到逗号

Use the pattern ([^,]*) to match everything upto a comma

>>> re.findall(r'\sante mí:\s+([^,]*)', mensaje)
['DANIEL ROLANDO  CORNEJO GALLARDO']