Created
October 9, 2015 22:23
-
-
Save gyrus/71ab184d98d19ab9f5a1 to your computer and use it in GitHub Desktop.
Regular expression to match a UK postcode
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
preg_match( '/([A-Za-z]{1,2}[0-9]{1,2})[\s]*([0-9][A-Za-z]{2})/', 'WC1N 3XX', $matches ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment