Test, validate and match regular expressions
Matches Canadian postal codes in the format A1A 1A1, allowing an optional space between the first three and last three characters. The pattern enforces alternating letters and digits, is case-insensitive due to both cases being included, and is commonly used for form validation or extracting postal codes from addresses.