Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
elegant, advanced and robust RegExp solution solution in Clear category for Three Words by leggewie
# This is a improvement for robustness on the awesome solution by gyahun_dash
# https://py.checkio.org/mission/three-words/publications/gyahun_dash/python-3/4th/share/517356748fe5f36f7d2a81e35bd8b042/
# explanation:
# (^|\s) - check for beginning of line or space character
# \D+ - greedy match for as many non-digit characters as possible
# {3} - look for 3 occurrences of (^|\s)\D+)
# (\s|$) - match whitespace or end-of-line (to prevent matching abc123 as third "word")
#
# if there is a match, True is returned, otherwise False
import re
def checkio(words):
return bool(re.search('((^|\s)\D+){3}(\s|$)', words))
May 22, 2021
Comments: