I would like to give some feedback about a regular expression that works for me locally but not here.
I attempt to find the first word in a given string by looking for pattern ".+|\s+|([\w|']+)\b".
As I said, the pattern works for me locally. If I run the code here I get the correct word returned for the first check, but hen the check fails.
Code used so far
import re
pattern = re.compile("\.+|\s+|([\w|']+)\b")
result = pattern.split(text)
result = [x for x in result if not (x == '' or x == None)][0]
return result
From: https://py.checkio.org/mission/first-word/solve/
HTTP_USER_AGENT:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:62.0) Gecko/20100101 Firefox/62.0
Created at: 2018/10/17 11:03; Updated at: 2018/10/17 13:16
The question is resolved.