Title |
Test
Find
Pattern Title
|
Expression |
^[D-d][K-k]( |-)[1-9]{1}[0-9]{3}$ |
Description |
match all danish postal code
update from last danish postal code expression |
Matches |
DK-1234 | dk 1234 | Dk-1234 |
Non-Matches |
DK 12345 |
Author |
Rating:
Not yet rated.
paul Snabilie
|
Source |
|
Your Rating |
|
Title: Incorrect regex
Name: Flemming
Date: 10/15/2008 12:11:24 PM
Comment:
This regex is wrong. Test: EK-4300, which shouldn't match, but it does.
The problems are the dashes in the first part, e.g. [D-d] which matches all characters from D to d, i.e. E,F,G...
Correct regex should be:
^[Dd][Kk]( |-)[1-9]{1}[0-9]{3}$