So I have two different regular expressions for zipcodes from two different countries. One being The Netherlands and the other one being Belgium.
The Netherlands:
.match(/^[1-9][0-9]{3} ?(?!sa|sd|ss)[A-Za-z]{2}$/g)
Belgium:
.match(/^[1-9]{1}\d{3}$/g)
The user can input either a dutch zipcode or a belgium zipcode. So for example the user can input: 1111 AA (Netherlands) or 1111 (Belgium). However I want regex to allow one of the two inputs, but I just can't get it to work
This is what I have tried so far:
.match(/^(?:[1-9]{1}\d{3}) | ([1-9][0-9]{3} ?(?!sa|sd|ss)[A-Za-z]{2}$)/g)
But it just messes up the whole regex and doesn't allow any of the 2 zipcodes. Am I misusing the OR operator?