Provide typical regex examples

Created on 5 April 2023, almost 2 years ago

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 https://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

Feature request
Status

Active

Version

2.0

Component

Code

Created by

🇩🇪Germany Anybody Porta Westfalica

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024