Toggle navigation
Regex DB
Search
Notice: This site is currently in beta. It may break at any time, and all URLs are subject to change.
Postal Code > UK
Favorite
British Postal Code Schema
Test with sample data
Normal
Quoted
/^(?:GIR 0AA|(?:(?:(?:A[BL]|B[ABDHLNRSTX]?|C[ABFHMORTVW]|D[ADEGHLNTY]|E[HNX]?|F[KY]|G[LUY]?|H[ADGPRSUX]|I[GMPV]|JE|K[ATWY]|L[ADELNSU]?|M[EKL]?|N[EGNPRW]?|O[LX]|P[AEHLOR]|R[GHM]|S[AEGK-PRSTY]?|T[ADFNQRSW]|UB|W[ADFNRSV]|YO|ZE)[1-9]?\d|(?:(?:E|N|NW|SE|SW|W)1|EC[1-4]|WC[12])[A-HJKMNPR-Y]|(?:SW|W)(?:[2-9]|[1-9]\d)|EC[1-9]\d)\d[ABD-HJLNP-UW-Z]{2}))$/i
'/^(?:GIR 0AA|(?:(?:(?:A[BL]|B[ABDHLNRSTX]?|C[ABFHMORTVW]|D[ADEGHLNTY]|E[HNX]?|F[KY]|G[LUY]?|H[ADGPRSUX]|I[GMPV]|JE|K[ATWY]|L[ADELNSU]?|M[EKL]?|N[EGNPRW]?|O[LX]|P[AEHLOR]|R[GHM]|S[AEGK-PRSTY]?|T[ADFNQRSW]|UB|W[ADFNRSV]|YO|ZE)[1-9]?\\d|(?:(?:E|N|NW|SE|SW|W)1|EC[1-4]|WC[12])[A-HJKMNPR-Y]|(?:SW|W)(?:[2-9]|[1-9]\\d)|EC[1-9]\\d)\\d[ABD-HJLNP-UW-Z]{2}))$/i'
See Also
Postal Code > UK (simple)
Sample Matches
Text
Result
A19XY
no match
AB19XY
Group #0
AB19XY
match
A129XY
no match
AB129XY
Group #0
AB129XY
match
A1Z9XY
no match
AB1Z9XY
no match
A12Z9XY
no match
AB12Z9XY
no match
Categories
[No Folder]
Base64 encoded string (RFC 4648)
Copyright year
Copyright year (html)
CSV
Dice roll spec
Identifier (in C-like programming languages)
LDAP query
SemVer
Vehicle Identification Number (VIN)
Boolean
Boolean value
False value
True value
Credit Card
American Express (advanced)
American Express (simple)
Discover (advanced)
Discover (simple)
MasterCard (advanced)
MasterCard (simple)
Visa (advanced)
Visa (simple)
CSS
CSS class
Hex color
Hex color (6 digit)
hsl()
hsla()
rgb()
rgba()
DateTime
Date MMDDYYY
Date with optional time (ISO 8601)
Date YYYYMMDD
Day of week
Duration (ISO 8601) - Find
Duration (ISO 8601) - Validate
Leap year
Name of month
Repeating interval (ISO 8601) (R<n>/<start>/<duration>)
Time
Time (00-24)
Time (h:m:s)
Email
Email address (advanced)
Email address (Blink/Chrome)
Email address (Gecko/Firefox)
Email address (PHP)
Email address (RFC 822)
Email address (simple)
Email address (Webkit/Safari)
Email address list
HTML5
Character entity reference
Duration (1d 2m ...)
Duration (ISO 8601)
Global date/time
Local date/time
Month
Time
Timezone offset
Week
Yearless date
ID
ISBN-10
ISBN-13
MAC address (advanced)
MAC address (simple)
SSN (loose)
SSN (strict)
UUID/GUID
UUID/GUID with optional braces
Number
Dollar value
File Size
Floating point
Floating point with exponent
Integer (loose, commas not allowed)
Integer (strict, commas allowed)
Natural number
Real number
Roman numeral
Whole number
Phone
Phone number
Phone number (7+ digits)
Postal Code
Australia
Australia (simple)
Belgium
Brazil
Canada
Canada (simple)
Denmark
France
Germany
Greenland
Italy
Netherlands
Netherlands (simple)
Norway
Spain
Switzerland
UK
(current)
UK (simple)
USA
Quoted String
'Single quotes' with backslash escape
'Single quotes' with quote escape
'Single' or "double" quotes with backslash escape
"Double quotes" with backslash escape
"Double quotes" with quote escape
String
Invalid UTF-8 character
Valid UTF-8 string
URL
IPv4 (RFC 3986)
IPv4 (simple)
IPv6 (RFC 2732) v1
IPv6 (RFC 2732) v2
URL encoded string
Valid URL (RFC 3986)
Valid URL (RFC 3986) (Advanced)