990601-1

Write an ABNF specification for Swedish social security numbers, written in the format shown by the example 41 02 01-1410. It is an advantage if the syntax shows that a social security number consists of local elements: Date, month and day of birth, a three-digit sequence number and a single check digit in the last character position.

Answer

Solution 1:

    year = 2D
    month = 2D
    day = 2D
    seqno = 3D
    checkdigit = D
    social-security-number = year " " month " " day 
"-" seqno checkdigit

Solution 2:

year = 2D
     month = ("1" / "2" / "3" ) D
     day = ("0" / "1" / "2" / "3" ) D
     seqno = 3D
     checkdigit = D
     social-security-number = year " " month " " day
"-" seqno checkdigit

Solution 3:

      year = 2D
      month = "01" / "02" / "03" / "04" / "05" / "06" /
              "07" / "08" / "09" / "10" / "11" / "12"
      day =   "01" / "02" / "03" / "04" / "05" / "06" /
              "07" / "08" / "09" / "10" / "11" / "12" /
              "13" / "14" / "15" / "16" / "17" / "18" /
"19" / "20" / "21" / "22" / "23" / "24" /
"25" / "26" / "27" / "28" / "29" / "30" / "31" seqno = 3D checkdigit = D social-security-number = year " " month " " day
"-" seqno checkdigit

Note: A correct social-security number (personnummer) in Sweden should never contain a latter. Numbers with letters in them are fictious numbers created by some systems in order to represent people who do not have any Swedish personnummer.

List of exam questions