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

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find Swedish social security number (Svenskt personnummer)
Expression
^(((20)((0[0-9])|(1[0-1])))|(([1][^0-8])?\d{2}))((0[1-9])|1[0-2])((0[1-9])|(2[0-9])|(3[01]))[-]?\d{4}$
Description
Matches a Swedish social security number in format CCYYMMDD-NNNN, CCYYMMDDNNNN, YYMMDD-NNNN and YYMMDDNNNN on a single line. More useful version of my earlier expression. Will only match 1900 - 2011 years.
Matches
7712314582 | 810325-0782 | 19771231-4582 | 197712314582
Non-Matches
137712314582 | 201211224567 | 10880215-0987
Author Rating: Not yet rated. Emil
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: You cannot have a birthday between 10-19
Name: Tiru
Date: 6/11/2014 6:37:54 AM
Comment:
This would be the correct validation: ^(((20)((0[0-9])|(1[0-4])))|(([1][^0-8])?\d{2}))((0[1-9])|1[0-2])((0[1-9])|(1[1-9])|(2[0-9])|(3[01]))[-]?\d{4}$


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