Provide typical regex examples [#3352390]
Table of Contents
Problem/Motivation
Thank you very much for this great and helpful module!
A client contact me (non-developer) and was afraid how to write the regex correctly. And I had to agree the current UI is not very user-friendly and even for developers there might open questions for the regex field.
For example the link on regex101.com/ doesn’t tell which flavor is correct. Is it PHP? That should please be pointed out in the field description.
Furthermore it would be super nice to have a list of typical examples. I could imagine for example the following:
- Exclude certain TLDs for email (*.ru, *.cn, …)
- Exclude certain freemail or throw-away-email hosters (*.freemail.com, …)
- Exclude certain usernames (*admin*, …)
- …
providing correct examples here, would be super helpful without having to add technical functionality.
For comparison: The Drupal 7 version used:
%: Matches any number of characters, even zero characters.
_: Matches exactly one character.
Which was clear even for non-developers.
Steps to reproduce
Open admin/config/people/user-restrictions/add and be afraid how to write the correct regex
Proposed resolution
Provide textual examples in the field description like the ones above.
Remaining tasks
User interface changes
API changes
Data model changes
Read more here: Source link
