lundi 27 août 2018

JS Javascript: Valide german town and postal code separated with comma

I want to check if the input town and postal code is possible. Checking if the town exists is not needed.

So my idea was to use a regexp expression to solve it, but I couldn't find a correct solution.

The format have to be like this:

Hamburg, 22850

or like this:

Hamburg 22850

I tried to valide the chars and the numbers separately, but in combynation with or without a comma I'm stuck.

Maybe you could help me :)

Aucun commentaire:

Enregistrer un commentaire