I have problem with writing regular expression ( php / js ) for Latvian citizen personal codes. Every citizen in Latvia has own personal code. The format is 11 digits and after the sixth digit there is dash. So first 6 digits are date of birth.
ddmmyy ( at example: 130589 ) then goes dash ( - ) then goes seventh digit, that can be 0, 1 or 2 which means century ( 0 for 19. century and 2 for 21. century ), and then goes digits from 0000 to 9999
Examples:
080189-12602
08 - day
01 - month
89 - year
- - dash
1 - 20th century
2602 - random 4 digit combination.
So question is can someone help me with writing regular expression ?