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

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find Swedish Personal Nr (Personnummer)
Expression
^\d{2}([0][1-9]|[1][0-2])([0][1-9]|[1-2][0-9]|[3][0-1])-\d{4}$
Description
Simple regex for the Swedish personal number. It's in the form: YYMMDD-xxxx where xxxx is an arbitrary number from 0000-9999.
Matches
791231-1234
Non-Matches
791332-1234
Author Rating: Not yet rated. Linus
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: Doesn't take into account that the last four characters can contain letters
Name: Thomas
Date: 8/25/2010 4:50:22 AM
Comment:
The last four digits/characters can actually contain non-numeric characters if the person is not a Swedish citizen, but still needs a person number because of studies in Sweden etc. Example: 810514-T896


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