LocalRegex provides validation for student ID numbers from major Zimbabwe educational institutions. The library includes support for universities and technical colleges with institution-specific ID formats.
The LocalSchools enum defines the supported educational institutions:
enum LocalSchools { /// Harare Institute of Technology hit, /// Telone Centre for Learning telone, /// University of Zimbabwe uz, /// Midlands State University msu}
import 'package:localregex/localregex.dart';void validateStudentID(String studentId) { // Check each institution if (LocalSchools.hit.isStudent(studentId)) { print('Valid HIT student ID'); } else if (LocalSchools.telone.isStudent(studentId)) { print('Valid Telone Centre for Learning student ID'); } else if (LocalSchools.uz.isStudent(studentId)) { print('Valid University of Zimbabwe student ID'); } else if (LocalSchools.msu.isStudent(studentId)) { print('Valid Midlands State University student ID'); } else { print('Invalid student ID format'); }}// Example usagevoid main() { validateStudentID('H180202M'); // Valid HIT student ID validateStudentID('T2216313T'); // Valid Telone student ID validateStudentID('R123456A'); // Valid UZ student ID validateStudentID('R1234567B'); // Valid MSU student ID validateStudentID('X123456A'); // Invalid student ID format}
Case Sensitivity: All student ID patterns require uppercase letters. Consider normalizing input to uppercase before validation:
final normalizedId = studentId.toUpperCase();if (LocalSchools.hit.isStudent(normalizedId)) { // Valid}
Institution-Specific Validation: Always validate against the specific institution rather than trying generic pattern matching, as multiple institutions may share similar formats.
Format Only: These validators only verify that the ID matches the institution’s format. They do not verify if the student is actually enrolled or if the ID is currently active.