A developer needs to ensure that a user-entered Canadian Postal Code follows the 'A1A 1A1' format before the user submits a form.
This validation should provide immediate feedback to the user on the client side.
Which type of rule is the most appropriate and efficient for this requirement?