feat: Add UK driving licence number recognizer#1857
Open
tee-jagz wants to merge 3 commits intomicrosoft:mainfrom
Open
feat: Add UK driving licence number recognizer#1857tee-jagz wants to merge 3 commits intomicrosoft:mainfrom
tee-jagz wants to merge 3 commits intomicrosoft:mainfrom
Conversation
Contributor
Author
|
@microsoft-github-policy-service agree |
10579a2 to
adad463
Compare
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.
adad463 to
a54c5f4
Compare
SharonHart
previously approved these changes
Feb 15, 2026
Contributor
There was a problem hiding this comment.
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
UkDrivingLicenceRecognizerwith 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. |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
uk_driving_licence_recognizer.py— recognizer classtest_uk_driving_licence_recognizer.py— 21 testsdefault_recognizers.yaml,__init__.pyexports,supported_entities.mddefault_recognizers.yaml— registered withenabled: falsesupported_entities.md— addedUK_DRIVING_LICENCErowIssue reference
N/A — new feature contribution
Checklist