简体   繁体   English

尽管使用 regex101 python,正则表达式返回空字符串

[英]Regex returns empty string despite working on regex101 python

I'm trying to do a regex on this string我正在尝试对这个字符串做一个正则表达式

str1 = "/*Jon is @developer & musician"

And it must return它必须返回

"Jon is developer musician" “Jon 是开发音乐家”

In regex 101 it works在正则表达式 101 中它有效

在此处输入图像描述

But in pyothon it just returns "Jon"但在 pyothon 中它只返回“Jon”

What about this.那这个呢。

>>> str1 = "/*Jon is @developer & musician"
>>> re.findall(r"\w+\s*", str1)
['Jon ', 'is ', 'developer ', 'musician']
>>> "".join(re.findall(r"\w+\s*", str1))
'Jon is developer musician'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM