Skip to content

Instantly share code, notes, and snippets.

@matifdeveloper
Created October 16, 2023 18:25
Show Gist options
  • Save matifdeveloper/f767104c0d38f48938462e29078e75ae to your computer and use it in GitHub Desktop.
Save matifdeveloper/f767104c0d38f48938462e29078e75ae to your computer and use it in GitHub Desktop.
UK Driving Licence Regex

UK Driving Licence Regex

Created with <3 with dartpad.dev.

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