Regex for first 3 of Canadian Postal Code | XM Community
Skip to main content
Solved

Regex for first 3 of Canadian Postal Code

  • October 17, 2023
  • 3 replies
  • 125 views

Forum|alt.badge.img+1

Hi! I’m hoping someone can help. I have never created a Regex Code before. What would the regex be for the first 3 characters of a Canadian postal code (ALPHA, NUMERIC, ALPHA)?

Thanks in advance!!
Shannon

Best answer by ash123

@Shannon OKeefe Yes, what you wrote above will only allow people to submit answers where the first three characters are in the order: alpha, numeric, alpha

3 replies

Forum|alt.badge.img+1
  • Author
  • 2 replies
  • October 17, 2023

would it be ([a-zA_Z][0-9][a-zA_Z])


Forum|alt.badge.img+14
  • Level 5 ●●●●●
  • 276 replies
  • Answer
  • October 17, 2023

@Shannon OKeefe Yes, what you wrote above will only allow people to submit answers where the first three characters are in the order: alpha, numeric, alpha


Forum|alt.badge.img+1
  • Author
  • 2 replies
  • October 17, 2023

Great! Thanks so much ash123