- [ ("byr", fourDigit 1920 2002)
- , ("iyr", fourDigit 2010 2020)
- , ("eyr", fourDigit 2020 2030)
- , ("hgt", \x->case x % (size x - 2, size x - 1) of
- "cm" = between 150 193 (toInt (x % (0, size x - 3)))
- "in" = between 59 76 (toInt (x % (0, size x - 3)))
- _ = False)
- , ("hcl", reg "#[0-9a-f]{6}")
- , ("ecl", flip isMember ["amb", "blu", "brn", "gry", "grn", "hzl", "oth"])
- , ("pid", reg "\\d{9}")
+ [ ("byr", "^(19[2-9]\\d|200[0-2])$")
+ , ("iyr", "^20(1\\d|20)$")
+ , ("eyr", "^20(2\\d|30)$")
+ , ("hgt", "^(1([5-8]\\d|9[0-3])cm|(59|6\\d|7[0-6])in)$")
+ , ("hcl", "^#[0-9a-f]{6}$")
+ , ("ecl", "^(amb|blu|brn|gry|grn|hzl|oth)$")
+ , ("pid", "^\\d{9}$")