RegexBuilder · regex answers
Regex to match letters in any language
/^\p{L}+$/u\p{L} matches any character the Unicode standard classifies as a letter, so Cyrillic, Greek, Arabic and CJK all pass. JavaScript requires the u flag for it; Python needs the third-party regex module, as the standard re does not support \p.
What each part does
| \p{L} | any Unicode letter |
| + | one or more of them |
| u | the unicode flag, without which \p is a syntax error in JavaScript |
Tested against real input
Every row below was run through the engine when this page was built. The third column is the substring the pattern actually matched.
| Input | Result | Matched |
|---|---|---|
| hello | matches | hello |
| Привет | matches | Привет |
| 日本語 | matches | 日本語 |
| Ελλάδα | matches | Ελλάδα |
| hello world | no match | — |
| abc123 | no match | — |
| héllo! | no match | — |
The mistake to avoid
Reaching for [a-zA-Z] and then filing bug reports about names. Roughly half the world's names contain a character outside that range.
Try it on your own text
Paste this pattern and your input, see each match highlighted with its capture groups, step through what the engine did, and get the equivalent syntax for JavaScript, Python, Java, Go and PCRE.
Open RegexBuilderOther regex answers
- Regex for an email address
- Regex for a US phone number
- Regex for an IPv4 address
- Regex for a URL
- Regex for a date in YYYY-MM-DD format
- Regex to match digits only
- Regex for alphanumeric characters
- Regex to find special characters
- Regex for a strong password
- Regex to match whitespace
- Regex to trim leading and trailing whitespace
- Regex for a UUID