Jump to content
View in the app

A better way to browse. Learn more.

Learn more

Allowed Characters in Registration Names (regex)

Featured Replies

I use the simple mode, but I would like to restrict how many repeats of special characters are allowed.

In simple mode, I allow: _.-

Looking at the advanced (regex) option: /^(([A-Za-z0-9_\.\-]+) ?)+$/u

Is there a regex expression which allow the same three special characters (_.-), but disallow any adjacent repeats of these there characters, or adjacent combination of these three characters? I'd also like to disallow use special characters from the beginning or end of the username, except for the use of a single . at the end.

For example, I'd like to disallow:

  • username___

  • user___name

  • ___username

  • _._username

  • user_-name

  • .username

  • username-

  • etc.

Allowed (examples)

  • username

  • user.name

  • username.

  • U.N.

  • u-n

  • etc.

As its an advanced option, helping with the regex itself would be outside the scope of standard support, so try this at your own risk of course. Something like

/^[A-Za-z0-9]+(?:[_.-][A-Za-z0-9]+)*\.?$/u
  • Author
1 hour ago, Marc said:

As its an advanced option, helping with the regex itself would be outside the scope of standard support, so try this at your own risk of course. Something like

/^[A-Za-z0-9]+(?:[_.-][A-Za-z0-9]+)*\.?$/u

Thank you Marc, much appreciated. I'll test it out carefully.

Recently Browsing 0

  • No registered users viewing this page.

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.