Simple JS regexp for swedish social security number.
1
2
3
4
5
6
7
/^\d{6,8}[-|(\s)]{0,1}\d{4}$/.test("195505055555") // true
/^\d{6,8}[-|(\s)]{0,1}\d{4}$/.test("19550505-5555") // true
/^\d{6,8}[-|(\s)]{0,1}\d{4}$/.test("550505-5555") // true
/^\d{6,8}[-|(\s)]{0,1}\d{4}$/.test("550505 5555") // true