简体   繁体   中英

regular expression for special case

The postcode must be of the form of two capitals, up to two digit numbers, followed by a space, up to two digits and two capital letters. For example, GU2 7XH is permitted but GU22 777XH is not, GU22 8AB is permitted but GU222 88AB is not. can someone help me acheive this

[A-Z]{2}[0-9]{1,2}\s[0-9]{1,2}[A-Z]{2}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM