Regex for Matching Letters Only

Matches a string made up entirely of alphabetic letters.

Published October 11, 2026

This regex matches strings made entirely of ASCII letters a–z and A–Z.

How the pattern works

Breaking the pattern down: [A-Za-z] = ASCII letters; + = one or more.

Test your regex against both matching and non-matching inputs; use the Regex tool on this site to experiment live.

Pattern tests

/^[A-Za-z]+$/
✓ 'Hello'
✓ 'abc'
✗ 'abc1'
✗ 'hello world'

Practical examples

The pattern

const re = /^[A-Za-z]+$/

Test it

const re = /^[A-Za-z]+$/
re.test('Hello')   // true
re.test('abc')   // true
re.test('abc1')   // false
re.test('hello world')   // false

In Python

import re
re.search(r'^[A-Za-z]+$', text)

Common mistakes

  • Rejecting accented letters.
  • Allowing empty strings with *.
  • Forgetting names with hyphens or apostrophes.

Key takeaways

  • Anchors (^ and $) make the whole string match instead of a part of it.
  • Regex checks format only; verify data separately when it matters.
  • Test with valid and invalid samples.

FAQ

Unicode letters?

Use \p{L} with the u flag in JavaScript.

Where can I test this pattern?

Use the Regex Tester on this site, or regex101.com.

More General articles