Skip to the content
Documentation

UserNameValidationRegex

No ratings yet

Summary

Settings regarding custom validation of user names

Usage

UserNameValidationRegex[]=

Description

This setting is available since Exponential 4.1. It is used for custom validation of user names which will affect new users, and existing users when they edit their credentials.

Examples

Example 1

UserNameValidationRegex[sw]=/^\s/
UserNameValidationErrorText[sw]=The user name cannot start with a white-space.

More examples

#UserNameValidationRegex[ew]=/\s$/
#UserNameValidationErrorText[ew]=The user name cannot end with a white-space.
#UserNameValidationRegex[rw]=/\s+/
#UserNameValidationErrorText[rw]=The user name cannot contain repeated white-space.
#UserNameValidationRegex[lb]=/\n|\r/
#UserNameValidationErrorText[lb]=The user name cannot contain line breaks.
#UserNameValidationRegex[t]=/\t/
#UserNameValidationErrorText[t]=The user name cannot contain tabs.

Alternative example only allowing 'word' characters

#UserNameValidationRegex[w]=/\W/
#UserNameValidationErrorText[w]=The user name can only contain a-z, digits or underline.
# Or
#UserNameValidationRegex[wh]=/[^A-Za-z0-9_-]/
#UserNameValidationErrorText[wh]=The user name can only contain a-z, digits, underline or hyphen.

# While testing add this at the end, just remember to remove it when your done.
#UserNameValidationRegex[test]=/\w/
#UserNameValidationErrorText[test]=The username seems to be ok!

Contributors

Comments

Add a comment

Comments are read by a moderator before they appear.