I am facing a challenge with regular expressions for zip codes from two different countries - The Netherlands and Belgium.
For The Netherlands:
.match(/^[1-9][0-9]{3} ?(?!sa|sd|ss)[A-Za-z]{2}$/g)
For Belgium:
.match(/^[1-9]{1}\d{3}$/g)
Users should be able to input either a Dutch zip code or a Belgian zip code, such as 1111 AA (Netherlands) or 1111 (Belgium). I have been attempting to create a regex pattern to allow for either input, but I haven't been successful so far.
This is my current attempt:
.match(/^(?:[1-9]{1}\d{3}) | ([1-9][0-9]{3} ?(?!sa|sd|ss)[A-Za-z]{2}$)/g)
However, this pattern seems to be causing issues and doesn't validate either of the two types of zip codes. Could it be that I am not using the OR operator correctly?