Text

Letters-Only Regex: ASCII, Accents, and Unicode

`[A-Za-z]+` is enough for ASCII letters, but it excludes accented characters. Unicode support matters as soon as your application handles real names and international text.

Before you start: test every pattern with examples that should match and examples that should fail.

ASCII letters only

This pattern restricts the entire value to A-Z or a-z.

Regex: ^[A-Za-z]+$

Adding common accented letters

Manual ranges can expand coverage, but they are easy to get wrong or incomplete.

Regex: ^[A-Za-zÀ-ÖØ-öø-ÿ]+$

Unicode properties

Modern engines may support Unicode properties such as \p{L} for any letter, usually together with a Unicode flag. Check your language support.

Do not over-restrict real names

Human names may contain spaces, hyphens, apostrophes, and characters from many writing systems. A simple “letters only” exercise should not become a harmful production validation rule.

Next step: test it for real

Use the Playground to experiment with the pattern, then practice in the game with feedback on false positives and false negatives.

Practice in the gameTest in Playground

Keep learning

← Back to learning hub