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

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find Swedish personnummer with accepted foreigners
Expression
^[0-9]{6}-[0-9pPtTfF][0-9]{3}$
Description
Other Swedish personnummer regexps do not take into account that at Swedish universities, foreigners might get special temporary personnummers with a "P", "T", or "F" instead of the first of the four last numbers. This code fixes the problem, but does not check the validity of the date, or the last number.
Matches
123456-1234 | 123456-P234 | 123456-f234
Non-Matches
123456-12 | 1234561234 | 123456
Author Rating: Not yet rated. Petter Terenius
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

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