RegExLib.com - The first Regular Expression Library on the Web!

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find Finnish social security number (hetu)
Expression
^(0[1-9]|[12]\d|3[01])(0[1-9]|1[0-2])([5-9]\d\+|\d\d-|[01]\dA)\d{3}[\dABCDEFHJKLMNPRSTUVWXY]$
Description
Description This is for the Finnish social security numbers (henkilötunnus / hetu). It consists of eleven characters of the form DDMMYYCZZZQ, where DDMMYY is the date of birth, C the century sign (-,+, or A), ZZZ the individual number (even for men and odd for female), and Q the control character or the checksum. It is calculated DDMMYYZZZ mod 31, where the remainder 0,1,2,..,31 is converted from the list 0,1,...A,B,C..Y . The G,I, O and Q are not in the list, they are too similar to numbers 1, 8 and 0 (zero). Note: This regex does not calculate the checksum (mod 31).
Matches
010593-123A | 010503A123A | 210566-022Y
Non-Matches
010593123A | 011403A123A | 011203-123O
Author Rating: The rating for this expression. Harri Luuppala
Source
Your Rating
Bad Good

Enter New Comment

Title

Name

Comment

Spammers suck - we apologize. Please enter the text shown below to enable your comment (not case sensitive - try as many times as you need to if the first ones are too hard):

Existing User Comments

Title: Finnish PID (a.k.a SSN)
Name: Harri Luuppala
Date: 6/14/2026 7:48:27 AM
Comment:
In Finland during 1964–1970 the personal identity code was known as sosiaaliturvatunnus (SOTU, Social Security number). The term is still widely in use unofficially (and incorrectly). The Personal Identity Code (Finnish: henkilötunnus (abbreviated as hetu), Swedish: personbeteckning), also known as Personal Identification Number, was introduced in 1964 and it is used for identifying the citizens in government and many corporate and other transactions. It consists of eleven characters of the form DDMMYYCZZZQ, where DDMMYY is the day, month and year of birth, C the century sign, ZZZ the individual number and Q the control character (checksum). The sign for the century is either + (1800–1899); -, U, V, W, X, or Y(1900–1999); or A, B, C, D, E, F (2000–2099). The individual number ZZZ distinguishes persons with the same date of birth from each other and it is odd for males and even for females and for people born in Finland or permanent residents its range is 002–899. Numbers 900–999 are used for temporary personal identification, for example in hospitals, when an official ID is not known or has not yet been given to a child born. Temporary IDs are not logged in the Finnish Population Information System.


Title: Finnish PID (a.k.a SSN)
Name: Harri Luuppala
Date: 6/14/2026 7:46:40 AM
Comment:
In Finland during 1964–1970 the personal identity code was known as sosiaaliturvatunnus (SOTU, Social Security number). The term is still widely in use unofficially (and incorrectly). The Personal Identity Code (Finnish: henkilötunnus (abbreviated as hetu), Swedish: personbeteckning), also known as Personal Identification Number, was introduced in 1964 and it is used for identifying the citizens in government and many corporate and other transactions. It consists of eleven characters of the form DDMMYYCZZZQ, where DDMMYY is the day, month and year of birth, C the century sign, ZZZ the individual number and Q the control character (checksum). The sign for the century is either + (1800–1899); -, U, V, W, X, or Y(1900–1999); or A, B, C, D, E, F (2000–2099). The individual number ZZZ distinguishes persons with the same date of birth from each other and it is odd for males and even for females and for people born in Finland or permanent residents its range is 002–899. Numbers 900–999 are used for temporary personal identification, for example in hospitals, when an official ID is not known or has not yet been given to a child born. Temporary IDs are not logged in the Finnish Population Information System.


Title: Minor suggestion
Name: Anon
Date: 6/3/2022 6:10:48 PM
Comment:
Try a slightly more simplified string and improved grouping like this: ^(0[1-9]|[12]\d|3[01])([0-1][1-9])(\d{2})(\+|-|A)(\d{3})(\d|[A-FHJ-NPR-Y])$


Title: Faulty
Name: Rubio
Date: 8/18/2021 6:01:48 AM
Comment:
E.g. 110721A846E is a perfectly valid, yet this regex doesn't give a match. BTW, the correct English translation for this ID is Personal Identity Code or PIC, not social security number.


Title: Faulty
Name: Rubio
Date: 8/18/2021 6:01:36 AM
Comment:
E.g. 110721A846E is a perfectly valid, yet this regex doesn't give a match. BTW, the correct English translation for this ID is Personal Identity Code or PIC, not social security number.


Copyright © 2001-2026, RegexAdvice.com | ASP.NET Tutorials