Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Regular expression to match a UK postcode
<?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
You can’t perform that action at this time.