Skip to content

feat: Add UK driving licence number recognizer#1857

Open
tee-jagz wants to merge 3 commits intomicrosoft:mainfrom
tee-jagz:feat/uk-driving-licence
Open

feat: Add UK driving licence number recognizer#1857
tee-jagz wants to merge 3 commits intomicrosoft:mainfrom
tee-jagz:feat/uk-driving-licence

Conversation

@tee-jagz
Copy link
Contributor

@tee-jagz tee-jagz commented Feb 14, 2026

Add UkDrivingLicenceRecognizer for detecting DVLA driving licence numbers. The 16-character alphanumeric format encodes surname, date of birth, and initials. Uses regex with embedded month/day validation and surname padding checks. Disabled by default per country-specific convention.

Change Description

Add a new country-specific recognizer for UK driving licence numbers (entity: UK_DRIVING_LICENCE). The recognizer detects 16-character DVLA licence numbers using regex pattern matching with context words and structural validation of the surname padding. The DVLA check digit algorithm is not public, so validation rejects clearly invalid patterns but does not confirm validity.

Files changed:

  • New: uk_driving_licence_recognizer.py — recognizer class
  • New: test_uk_driving_licence_recognizer.py — 21 tests
  • Updated: default_recognizers.yaml, __init__.py exports, supported_entities.md
  • Updated: default_recognizers.yaml — registered with enabled: false
  • Updated: supported_entities.md — added UK_DRIVING_LICENCE row

Issue reference

N/A — new feature contribution

Checklist

  • I have reviewed the contribution guidelines
  • I have signed the CLA (if required)
  • My code includes unit tests
  • All unit tests and lint checks pass locally
  • My PR contains documentation updates / additions if required

@tee-jagz
Copy link
Contributor Author

@microsoft-github-policy-service agree

@tee-jagz tee-jagz force-pushed the feat/uk-driving-licence branch 2 times, most recently from 10579a2 to adad463 Compare February 14, 2026 17:23
Add UkDrivingLicenceRecognizer for detecting DVLA driving licence numbers.
The 16-character alphanumeric format encodes surname, date of birth, and
initials. Uses regex with embedded month/day validation and surname padding
checks. Disabled by default per country-specific convention.
@tee-jagz tee-jagz force-pushed the feat/uk-driving-licence branch from adad463 to a54c5f4 Compare February 14, 2026 23:11
SharonHart
SharonHart previously approved these changes Feb 15, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new UK-specific predefined recognizer to Presidio Analyzer for detecting DVLA driving licence numbers (UK_DRIVING_LICENCE), including configuration, exports, docs, and unit tests.

Changes:

  • Introduces UkDrivingLicenceRecognizer with a DVLA-format regex plus additional surname-padding validation.
  • Adds a dedicated test suite covering valid/invalid formats and basic embedding/casing scenarios.
  • Registers the recognizer in default configuration (disabled), updates public exports, supported-entities docs, and changelog.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
presidio-analyzer/presidio_analyzer/predefined_recognizers/country_specific/uk/uk_driving_licence_recognizer.py New DVLA driving licence PatternRecognizer with regex + validate_result() pruning logic.
presidio-analyzer/tests/test_uk_driving_licence_recognizer.py New unit tests for valid/invalid UK driving licence numbers.
presidio-analyzer/presidio_analyzer/predefined_recognizers/country_specific/uk/init.py Exposes UkDrivingLicenceRecognizer from the UK recognizers package.
presidio-analyzer/presidio_analyzer/predefined_recognizers/init.py Re-exports UkDrivingLicenceRecognizer at the predefined recognizers top-level.
presidio-analyzer/presidio_analyzer/conf/default_recognizers.yaml Registers the recognizer in default config with enabled: false.
docs/supported_entities.md Documents the new UK_DRIVING_LICENCE supported entity.
CHANGELOG.md Adds an Analyzer “Added” entry for the new recognizer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Comments