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: 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-2025, RegexAdvice.com | ASP.NET Tutorials