Skip to content
Advertisement

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

I’m trying to do a regex on this string

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

And it must return

“Jon is developer musician”

In regex 101 it works

enter image description here

But in pyothon it just returns “Jon”

Advertisement

Answer

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'
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement