1

The following line of code works well to check a postcode format. However it doesn't allow to use space in between:

var postMatch = /[A-z]{1,2}[0-9]{1,2} ?[0-9][A-Z]{2}/i;

This would be correct: se34tyu

This one no: se34 tyu

What can I add to make that happen?

Full code

4

1 に答える 1

2

\s*任意のスペースを許可するために使用します。

/[A-z]{1,2}[0-9]{1,2}\s*[0-9][A-Z]{2}/i
于 2013-03-20T16:45:35.727 に答える