linfo2335-programming-parad.../project-3/regex/flaw_5.py

13 lines
264 B
Python
Raw Normal View History

2024-05-23 14:47:20 +02:00
import re
def detect_too_much_indent(code):
regex = re.compile(
r"^(?P<indent> +)\S.*\n(?P=indent)(?P<indent2> +)\S.*\n(?P=indent)(?P=indent2)(?P<indent3> +)\S.*",
re.MULTILINE,
)
result = regex.search(code)
return bool(result)