Skip to content

Instantly share code, notes, and snippets.

@Edofre
Created March 26, 2016 20:27
Show Gist options
  • Save Edofre/75fc878e5b51bef47186 to your computer and use it in GitHub Desktop.
Save Edofre/75fc878e5b51bef47186 to your computer and use it in GitHub Desktop.
<?php
namespace common\components\validators;
class ZipCodeValidator extends \yii\validators\RegularExpressionValidator
{
public $pattern = '/^[0-9]{4} {0,1}[a-z|A-Z]{2}$/'; // 1234AB or 1234 AB
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment