Skip to content

Instantly share code, notes, and snippets.

@shandanjay
Last active November 29, 2017 13:15
Show Gist options
  • Save shandanjay/e3010f2825f85c20bc3bfa56ea1fa730 to your computer and use it in GitHub Desktop.
Save shandanjay/e3010f2825f85c20bc3bfa56ea1fa730 to your computer and use it in GitHub Desktop.
Sri Lanka Vehicle plate number RegEx
<?php
$valid = '64-8681'; // BAC-1488
$invalid = '00-8681'; // A1C-3422
$re = '/^([a-zA-Z]{1,3}|((?!0*-)[0-9]{1,3}))-[0-9]{4}(?<!0{4})/m';
echo preg_match($re, $valid); //true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment