I am trying to validate UK postcodes inside of a Laravel Validation regex like this..
'postcode' => ['required','regex:/^[A-Z]{1,2}\d[A-Z\d]? ?\d[A-Z]{2}|GIR ?0A{2}+$/']
The regex comes from the post at UK Postcode Regex (Comprehensive) and is..
^([A-Z]{1,2}\d[A-Z\d]? ?\d[A-Z]{2}|GIR ?0A{2})$
The regex works when run on https://regex101.com/r/ajQHrd/15 for the test postcode RT4 5GJ but it fails in my Laravel app.
I am assuming this is just my implementation within Laravel, can anyone see what I am doing wrong?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire