Assume I have the following list:
[4486AE Capelle aan de Ijsel, 4706TR Amsterdam]
I would like to extract the zip code for each element.
The desired output is:
[4486AE, 4706TR]
I tried to find a regular expression for Dutch zip codes in Python. However, I only found a JavaScript expression. This is what I tried so far:
import re
test = '4706TR Amsterdam'
match = re.search(r"/^(?:NL-)?(\d{4})\s*([A-Z]{2})$/i", test)
print(match)
This gives me an empty result. Here is where I got the expression from: https://rgxdb.com/r/4W9GV8AC
Anyone has an idea how to solve this? Other SO posts do not focus on Python expression for Dutch zip codes.