Skip to content

Instantly share code, notes, and snippets.

@basyusuf
Created May 3, 2021 13:34
Show Gist options
  • Save basyusuf/660ec8684c6cfc0f8c2e49362cac2670 to your computer and use it in GitHub Desktop.
Save basyusuf/660ec8684c6cfc0f8c2e49362cac2670 to your computer and use it in GitHub Desktop.
Turkey Plate Number Regex [JS][TS]
let plates = ["41K1111","41k1111","41 K 1111","41K 1111","41 YB 443","41 YBA 443","41 k 4141"];
let regexFormule = /^(0[1-9]|[1-7][0-9]|8[01])((\s?[a-zA-Z]\s?)(\d{4,5})|(\s?[a-zA-Z]{2}\s?)(\d{3,4})|(\s?[a-zA-Z]{3}\s?)(\d{2,3}))$/
plates.map((item)=>{
let checkRegex = item.match(regexFormule);
if(checkRegex){
console.info("Success");
}
});
/*
Inputs
41K1111
41k1111
41 K 1111
41K 1111
41 YB 443
41 YBA 443
41 k 4141
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment