guard the frobbing regexes
[aoc20.git] / 4 / one.icl
index 48744d4..5e7f5f0 100644 (file)
--- a/4/one.icl
+++ b/4/one.icl
@@ -27,7 +27,6 @@ Start w
        = (one passports, two passports)
 
 one = length o filter (valid [(n, const True)\\n<-["byr", "iyr", "eyr", "hgt", "hcl", "ecl", "pid"]])
-
 two = length o filter (valid
        [ ("byr", fourDigit 1920 2002)
        , ("iyr", fourDigit 2010 2020)
@@ -41,5 +40,5 @@ two = length o filter (valid
        , ("pid", reg "\\d{9}")
        ])
 fourDigit lo hi x = reg "\\d{4}" x && between lo hi (toInt x)
-reg p = not o isEmpty o match p
+reg p = not o isEmpty o match ("^"+++p+++"$")
 between lo hi x = x >= lo && x <= hi