Shorter regex

This commit is contained in:
Lynn Ochs 2020-12-05 09:54:41 +01:00
parent 09b04a5c49
commit 0bd4f1c747

View File

@ -1,2 +1,2 @@
import re import re
print(sum(map(lambda x:6<len(re.findall(r'\b(by.:(1...|200[0-2])|iyr:20(1.|20)|eyr:20(2.|30)|hgt:...(n|cm)|hc.:#.{6}|ec.:..[buynlh]|pi.:\d{9})\b',x)),open(0).read().split("\n\n")))) print(sum(map(lambda x:6<len(re.findall(r'by.:(1...|200[0-2])|iyr:20(1.|20)|eyr:20(2.|30)|hgt:...(n|cm)|hc.:#.{6}|ec.:..[buynlh]|pi.:\d{9}\b',x)),open(0).read().split("\n\n"))))