Skip to main content

Overview

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.

LocalSchools Enum

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
}

isStudent() Extension Method

The isStudent() method is an extension on the LocalSchools enum that validates student IDs for the selected institution.
studentId
String
required
The student ID number to validate
Returns: bool - true if the ID matches the institution’s format, false otherwise

Usage Pattern

LocalSchools.institutionName.isStudent(studentId)

Supported Institutions

Harare Institute of Technology (HIT)

LocalSchools.hit
enum
Validates HIT student IDs
Pattern: H[0-9]{6}[A-Z]$ Format Structure:
  • Starts with letter H
  • Followed by 6 digits
  • Ends with 1 uppercase letter
Total Length: 8 characters
LocalSchools.hit.isStudent('H180202M');  // true
LocalSchools.hit.isStudent('H210456K');  // true
LocalSchools.hit.isStudent('H195678A');  // true
HIT is a public technical college in Harare, Zimbabwe, offering technology and engineering programs.

Telone Centre for Learning

LocalSchools.telone
enum
Validates Telone Centre for Learning student IDs
Pattern: T[0-9]{7}[A-Z]$ Format Structure:
  • Starts with letter T
  • Followed by 7 digits
  • Ends with 1 uppercase letter
Total Length: 9 characters
LocalSchools.telone.isStudent('T2216313T');  // true
LocalSchools.telone.isStudent('T1234567A');  // true
LocalSchools.telone.isStudent('T9876543Z');  // true
Telone Centre for Learning is an educational institution associated with TelOne, Zimbabwe’s telecommunications company.

University of Zimbabwe (UZ)

LocalSchools.uz
enum
Validates University of Zimbabwe student IDs
Pattern: R[0-9]{6}[A-Z]$ Format Structure:
  • Starts with letter R
  • Followed by 6 digits
  • Ends with 1 uppercase letter
Total Length: 8 characters
LocalSchools.uz.isStudent('R123456A');  // true
LocalSchools.uz.isStudent('R210987B');  // true
LocalSchools.uz.isStudent('R195432M');  // true
The University of Zimbabwe (UZ) is the oldest and largest university in Zimbabwe, established in 1952.

Midlands State University (MSU)

LocalSchools.msu
enum
Validates Midlands State University student IDs
Pattern: R[0-9]{7}[A-Z]$ Format Structure:
  • Starts with letter R
  • Followed by 7 digits
  • Ends with 1 uppercase letter
Total Length: 9 characters
LocalSchools.msu.isStudent('R1234567A');  // true
LocalSchools.msu.isStudent('R2109876B');  // true
LocalSchools.msu.isStudent('R9876543Z');  // true
Midlands State University (MSU) is located in Gweru, Zimbabwe, and was established in 1999.

Format Comparison

HIT

Pattern: H123456AH + 6 digits + letter (8 chars)

Telone

Pattern: T1234567AT + 7 digits + letter (9 chars)

UZ

Pattern: R123456AR + 6 digits + letter (8 chars)

MSU

Pattern: R1234567AR + 7 digits + letter (9 chars)

Pattern Summary Table

InstitutionPrefixDigitsFormatExample
HITH6H[0-9]{6}[A-Z]H180202M
TeloneT7T[0-9]{7}[A-Z]T2216313T
UZR6R[0-9]{6}[A-Z]R123456A
MSUR7R[0-9]{7}[A-Z]R1234567A
UZ vs MSU: Both universities use the prefix R, but UZ uses 6 digits while MSU uses 7 digits. Make sure to validate against the correct institution.

Complete Example

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 usage
void 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
}

Validation by Institution

// Harare Institute of Technology
final hitId = 'H180202M';

if (LocalSchools.hit.isStudent(hitId)) {
  print('Valid HIT student');
}
  • Prefix: H
  • Length: 8 characters
  • Example: H180202M

Best Practices

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.

Distinguishing Between UZ and MSU

Since both UZ and MSU use the R prefix, you need to check the digit count:
void identifyRPrefixStudent(String studentId) {
  if (studentId.startsWith('R')) {
    if (LocalSchools.uz.isStudent(studentId)) {
      print('University of Zimbabwe (6 digits)');
    } else if (LocalSchools.msu.isStudent(studentId)) {
      print('Midlands State University (7 digits)');
    } else {
      print('Invalid R-prefix student ID');
    }
  }
}

identifyRPrefixStudent('R123456A');   // UZ (6 digits)
identifyRPrefixStudent('R1234567B');  // MSU (7 digits)

Build docs developers (and LLMs) love