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

8 lines
178 B
Python
Raw Normal View History

2024-05-23 14:47:20 +02:00
import re
def detect_hardcoded_list(code):
regex = r"\[([^,\]\[]+,){2,}([^,\]\[]+)\]"
result = re.search(regex, code)
if result:
return True
return False