Letters and numbers
Allows only ASCII letters and digits.
Suggested pattern
^[A-Za-z0-9]+$
What it matches
Franck2026User123
Common limitations
- No underscores or hyphens.
- ASCII only.
Visual regex workbench
Build, import, explain, test and share regex visually.
Regex guide
Username validation is a common regex use case for login forms, profiles, admin panels, games and community platforms. This guide provides practical username regex examples you can test and adapt.
Allows only ASCII letters and digits.
^[A-Za-z0-9]+$
Franck2026User123Allows common username characters.
^[A-Za-z0-9_]+$
john_doeuser_123Allows letters, numbers and underscores from 3 to 20 characters.
^[A-Za-z0-9_]{3,20}$
john_doeuser_123Allows lowercase letters, numbers and underscores only.
^[a-z0-9_]{3,20}$
john_doeuser_123Allows letters, numbers, underscores and hyphens.
^[A-Za-z0-9_-]{3,20}$
john-doeuser_123Allows Unicode letters, numbers and underscores.
^[\p{L}\p{N}_]{3,20}$
françois用户123A username regex is a pattern used to check whether a username follows the rules of a website, app, game or internal system.
It can define allowed characters, minimum length, maximum length, case sensitivity and whether symbols such as underscores or hyphens are accepted.
Most username rules allow letters and numbers, then optionally add underscores, hyphens or dots.
A common approach is to require between 3 and 20 characters, reject spaces and keep the username easy to display in URLs and profiles.
ASCII username regex patterns are simpler and work well for English-only systems.
Unicode username patterns are better for international websites because they can allow accented letters and non-Latin scripts, but they require Unicode-aware regex support.
A regex can check the format of a username, but it cannot know whether the username is already taken.
Availability checks, reserved names, banned words and account rules should still be handled by server-side validation.