[GH-ISSUE #788] Proposed regular expressions fit too many digits #11112

Open
opened 2026-07-31 02:53:14 -05:00 by GiteaMirror · 1 comment
Owner

Originally created by @rammi62 on GitHub (Dec 27, 2021).
Original GitHub issue: https://github.com/semver/semver/issues/788

The currently proposed regular expressions use the \dmeta character, which is nowadays usually matching digits in the Unicode sense. So it does not only match ASCII 0-9, but also something like Devanagiri digits.

As this is obviously wrong just use plain old [0-9]instead.

Originally created by @rammi62 on GitHub (Dec 27, 2021). Original GitHub issue: https://github.com/semver/semver/issues/788 The currently proposed regular expressions use the `\d`meta character, which is nowadays usually matching digits in the Unicode sense. So it does not only match ASCII 0-9, but also something like [Devanagiri digits](https://en.wikipedia.org/wiki/Devanagari_numerals). As this is obviously wrong just use plain old `[0-9]`instead.
Author
Owner

@wyattscarpenter commented on GitHub (Jul 14, 2026):

It seems like about half of the flavors on regex101.com are willing to accept 1६.2.3 as a match for the semver regex, and half are not. As this seems undesirable, I agree that [0-9] should be used instead. Especially because, eg, ६.2.3 is never accepted.

It's also crazy to me that things would disagree about what \d means, but here we are.

<!-- gh-comment-id:4964822856 --> @wyattscarpenter commented on GitHub (Jul 14, 2026): It seems like about half of the flavors on regex101.com are willing to accept `1६.2.3` as a match for the semver regex, and half are not. As this seems undesirable, I agree that `[0-9]` should be used instead. Especially because, eg, `६.2.3` is never accepted. It's also crazy to me that things would disagree about what `\d` means, but here we are.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/semver#11112