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

Clarify ASCII numerals in alpha_dash and alpha_num validation rules #10220

Open
wants to merge 1 commit into
base: 12.x
Choose a base branch
from

Conversation

austincarpenter
Copy link

@austincarpenter austincarpenter commented Mar 1, 2025

ASCII characters in the \p{L} regex ranges are clarified as a-z and A-Z for the alpha_dash and alpha_num validation rules. ASCII numerals in the \p{N} range (0-9) are not.

@austincarpenter austincarpenter changed the title Clarify ASCII numerals Clarify ASCII numerals in alpha* validation rules Mar 1, 2025
@austincarpenter austincarpenter changed the title Clarify ASCII numerals in alpha* validation rules Clarify ASCII numerals in alpha_dash and alpha_num validation rules Mar 1, 2025
@austincarpenter
Copy link
Author

Should the alpha_dash description go one step further? I.e.:

"To restrict this validation rule to characters in the ASCII range (a-z, A-Z, 0-9, - and _), you may provide..."

I feel like most people would always opt for the :ascii variant of the rule and having the ranges comma-separated like this without describing them makes visually identifying the rules much easier.

@@ -1214,7 +1214,7 @@ To restrict this validation rule to characters in the ASCII range (`a-z` and `A-

The field under validation must be entirely Unicode alpha-numeric characters contained in [`\p{L}`](https://util.unicode.org/UnicodeJsps/list-unicodeset.jsp?a=%5B%3AL%3A%5D&g=&i=), [`\p{M}`](https://util.unicode.org/UnicodeJsps/list-unicodeset.jsp?a=%5B%3AM%3A%5D&g=&i=), [`\p{N}`](https://util.unicode.org/UnicodeJsps/list-unicodeset.jsp?a=%5B%3AN%3A%5D&g=&i=), as well as ASCII dashes (`-`) and ASCII underscores (`_`).
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe, we could highlight the "numeric" as alpha_dash looks like the alpha rule plus an additional dash, not the alpha_num rule plus dash:

Suggested change
The field under validation must be entirely Unicode alpha-numeric characters contained in [`\p{L}`](https://util.unicode.org/UnicodeJsps/list-unicodeset.jsp?a=%5B%3AL%3A%5D&g=&i=), [`\p{M}`](https://util.unicode.org/UnicodeJsps/list-unicodeset.jsp?a=%5B%3AM%3A%5D&g=&i=), [`\p{N}`](https://util.unicode.org/UnicodeJsps/list-unicodeset.jsp?a=%5B%3AN%3A%5D&g=&i=), as well as ASCII dashes (`-`) and ASCII underscores (`_`).
The field under validation must be entirely Unicode alpha-**numeric** characters contained in [`\p{L}`](https://util.unicode.org/UnicodeJsps/list-unicodeset.jsp?a=%5B%3AL%3A%5D&g=&i=), [`\p{M}`](https://util.unicode.org/UnicodeJsps/list-unicodeset.jsp?a=%5B%3AM%3A%5D&g=&i=), [`\p{N}`](https://util.unicode.org/UnicodeJsps/list-unicodeset.jsp?a=%5B%3AN%3A%5D&g=&i=), as well as ASCII dashes (`-`) and ASCII underscores (`_`).

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.

2 participants