I think this might work. Let you give it a try.
REG_MATCH(POSTAL_CODE, '^(?:\\d{3}|[A-Za-z]\\d[A-Za-z])')
- ^ asserts that the match starts at the beginning of the string.
- (?: ... ) is a non-capturing group, allowing you to match either
- \d{3}: exactly three digits.
- [A-Za-z]\d[A-Za-z]: a pattern with a letter, a digit, and another letter (case-insensitive).