Created with <3 with dartpad.dev.
Created
October 16, 2023 18:25
-
-
Save matifdeveloper/f767104c0d38f48938462e29078e75ae to your computer and use it in GitHub Desktop.
UK Driving Licence Regex
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
import 'dart:core'; | |
bool isValidUKDrivingLicense(String input) { | |
RegExp regex = RegExp(r'^[A-Z9]{5}\d{6}[A-Z9]{2}\d[A-Z]{2}$'); | |
return regex.hasMatch(input); | |
} | |
void main() { | |
String drivingLicense = 'BILAL002031M99ZE'; // Replace with your driving license number | |
if (isValidUKDrivingLicense(drivingLicense)) { | |
print('Valid UK driving license number'); | |
} else { | |
print('Invalid UK driving license number'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment