Regular Expressions 101

Community Patterns

Community Library Entry

1

Regular Expression
PCRE (PHP <7.3)

/
^\d{6}(\d{2})?[-+]\d{4}$
/
mg

Description

A simple regex for matching the format of swedish personal identifier numbers.

They can be in the format of: yymmdd-nnnn yymmdd+nnnn yyyymmdd-nnnn yyyymmdd+nnnn

This does not check

Submitted by anonymous - 8 years ago