Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set a boundary for the regular expression pattern #3

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

saevarom
Copy link

If the boundary is not set, a user can enter a longer kennitala, and just as long as the check digit is at the right location from the end of the string, the kennitala is valid.

Example:
This kennitala is valid without this fix: 28129420229.
It's obviously not valid, beacuse it is 11 digits. But since the regular expression is fine with matching the first 10 characters, and then just checking the check digit at the [-1] location, it passes as valid.

With this fix, this kennitala would not pass the boundary check, i.e. it must be 6+4 characters (optional hyphen) and then a boundary, e.g. end of the string.

If the boundary is not set, a user can enter a longer kennitala, and just as long as the check digit is at the right location from the end of the string, the kennitala is valid.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant