0
尋找一個正則表達式允許低於2個郵政編碼阿魯巴和巴巴多斯JavaScript的正則表達式支持阿魯巴和巴巴多斯郵政編碼
- Aruba - 0000AW (Only 6 characters are allowed in the format 4
digit(only 0) at the beginning and 2 characters (only A and W) at the
end)
- Barbados - BB15094 (Only 7 characters are allowed in the format 2
characters(only B) at the beginning and 4 digits (0 t0 9) at the end)
有人可以幫我拿到這個正則表達式?
我想巴巴多斯 - /^[Bb]{2}?[0-9]{5}$/
和阿魯巴 - /^[0]{4}?[Aa]{1}[Ww]{1}$/
。
30分鐘[花在這裏](https://regexone.com/)將教你如何寫下它。 –
@WiktorStribiżew感謝thids鏈接。 對於巴巴多斯我試過/^[Bb] [Bb]?[0-9] [0-9] [0-9] [0-9] [0-9] $ /,它的工作原理。但是我不想重複[0-9] 5次。能否請你幫忙 ? – Kenta
您錯過了[*第6課:抓住一些zzz的*](https://regexone.com/lesson/repeating_characters)。 –