Don't forget about names like:

  • Mathias d'Arras
  • Martin Luther King, Jr.
  • Hector Sausage-Hausen

This should do the trick for most things:

/^[a-z ,.'-]+$/i

OR Support international names with super sweet unicode:

/^[a-zA-ZàáâäãåąčćęèéêëėįìíîïłńòóôöõøùúûüųūÿýżźñçčšžæÀÁÂÄÃÅĄĆČĖĘÈÉÊËÌÍÎÏĮŁŃÒÓÔÖÕØÙÚÛÜŲŪŸÝŻŹÑßÇŒÆČŠŽ∂ð ,.'-]+$/u

Answer from maček on Stack Overflow
🌐
Medium
a-tokyo.medium.com › first-and-last-name-validation-for-forms-and-databases-d3edf29ad29d
First and Last name validation for forms and databases | by Ahmed Tokyo | Medium
May 5, 2025 - To achieve this we replaced [\-’]{0,1} with ([ \-’]{0,1}[a-zA-Z]+){0,2}]) this forces at least a single alphabetic letter after the special character, while also allowing the name to have length 1. We replace the {1,3} with {0,2} to achieve the same result (min 1, max 3 blocks); since the regex now forces alphabet at the end, we need to replace n with n-1 to achieve the same validation (accounting for the alpha prefix).
Discussions

Java Regex to Validate Full Name allow only Spaces and Letters - Stack Overflow
I want regex to validate for only letters and spaces. Basically this is to validate full name. Ex: Mr Steve Collins or Steve Collins I tried this regex. "[a-zA-Z]+\.?" But didnt work. Can someone More on stackoverflow.com
🌐 stackoverflow.com
How to use regex to validate only alphabets | OutSystems
I have a Input block with input type as Text. I want to apply regex to filter out numeric numbers and Special characters on keypress for Mobile Development.(eg., Name inputfield must take only Alphabets) · I have checked this and this and this non worked out/Not understanding More on outsystems.com
🌐 outsystems.com
January 8, 2019
Regular expression for name field in javascript validation - Stack Overflow
i need a regular expression in javascript validation. Regular expression for name field that will accept alphabets and only space character between words and total characters in the field should be... More on stackoverflow.com
🌐 stackoverflow.com
regular expressions - Best REGEX for first/last name validation? - Salesforce Stack Exchange
Looking to stop people putting initials in the First / Last name fields, plus any special characters that you would not associate with a name. I've got something, although it is coming unstuck on n... More on salesforce.stackexchange.com
🌐 salesforce.stackexchange.com
🌐
Laasya Setty Blogs
laasyasettyblog.hashnode.dev › validating-username-using-regex
Validating Username Using REGEX. - Laasya Setty Blogs
November 28, 2020 - Let's solve it.💪 · I recommend you to try before seeing the solution. ... Creating a regex pattern for username validation. String regularExpression= "^[A-Za-z][A-Za-z0-9_]{7,29}$"; A valid username should start with an alphabet so, [A-Za-z].
🌐
NYC PHP Developer
andrewwoods.net › blog › 2018 › name-validation-regex
Name Validation Regex for People's Names | NYC PHP Developer | Andrew Woods
September 19, 2018 - Let’s examine the expression. In it’s current form, it’s too simplistic. It says that only word characters are valid. That means no spaces, no apostrophes, and no umlauts, accents, or hyphens. Word characters are limited to the English alphabet, digits, and underscores.
🌐
PHPpot
phppot.com › javascript › validate-name-javascript
How to validate first name and last name in JavaScript? - PHPpot
February 11, 2024 - From there, it calls the validateName to check and confirm that the name field values are not empty and are in the right format. It ensures that both the first and last names contain only alphabets (allows both uppercase and lowercase letters).
🌐
OutSystems
outsystems.com › forums › discussion › 43962 › how-to-use-regex-to-validate-only-alphabets
How to use regex to validate only alphabets | OutSystems
January 8, 2019 - I have a Input block with input type as Text. I want to apply regex to filter out numeric numbers and Special characters on keypress for Mobile Development.(eg., Name inputfield must take only Alphabets) · I have checked this and this and this non worked out/Not understanding
Find elsewhere
🌐
Atlassian
confluence.atlassian.com › jirakb › using-forms-regex-validation-1255454685.html
Using Forms Regex validation | Jira | Atlassian Documentation
Next, add the expression you want to validate against. Then add the message your users will see if the validation fails. If I need a full name field validator that only alphabetic letters are allowed and that is in the format of Name and Surname and accepts compound names.
🌐
W3Schools Blog
w3schools.blog › home › javascript alphabets validation
JavaScript alphabets validation - W3Schools.blog
May 20, 2019 - Letters or alphabets-only validation ... /^[A-Za-z]+$/ Example: <!DOCTYPE html> <html lang="en"> <head> <script> function lettersOnlyCheck(name) { var regEx = /^[A-Za-z]+$/; if(name.value.match(regEx)) { return true; } else { alert("Please enter letters only."); return false; } } ...
🌐
RegExr
regexr.com › 3f8cm
First/Last Name Validator
RegExr is an online tool to learn, build, & test Regular Expressions (RegEx / RegExp). Supports JavaScript & PHP/PCRE RegEx. Results update in real-time as you type. Roll over a match or expression for details. Validate patterns with suites of Tests.
🌐
Prithu Banerjee
prithubanerjee.wordpress.com › 2014 › 04 › 05 › important-regular-expressions-validation
Important REGULAR EXPRESSIONS Validation | Prithu Banerjee
April 5, 2014 - 1. Name with space allowed Regular Expression : ^[a-zA-Z''-'\s]{1,40}$ Detail : The expression allows user to enter name (alphabets only) with space allowed. String Passes : 'denial', 'denial Wayne' String Fails : 'denial-wayne','denial45wayne' ...
🌐
W3Resource
w3resource.com › javascript › form › all-letters-field.php
JavaScript: HTML Form validation - checking for all letters
August 19, 2022 - Next the match() method of string object is used to match the said regular expression against the input value. Here is the complete web document. ... <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>JavaScript form validation - checking all letters</title> <link rel='stylesheet' href='form-style.css' type='text/css' /> </head> <body onload='document.form1.text1.focus()'> <div class="mail"> <h2>Enter your Name and Submit</h2> <form name="form1" action="#"> <ul> <li>Code:</li> <li><input type='text' name='text1'/></li> <li class="rq">*Enter alphabets only.</li> <li>&nbsp;</li> <li><input type="submit" name="submit" value="Submit" onclick="allLetter(document.form1.text1)" /></li> <li>&nbsp;</li> </ul> </form> </div> <script src="all-letter.js"> </script> </body> </html>
🌐
DEV Community
dev.to › fromwentzitcame › username-and-password-validation-using-regex-2175
Username and Password Validation Using Regex - DEV Community
June 24, 2023 - Basically, this is ensuring that the entire string follows our rules, rather than only a subset of the string. [...] indicates a particular set of valid characters, otherwise called a character class; 0-9 allows numbers, A-Z allows uppercase letters...
🌐
regex101
regex101.com › library › gK4eN5
regex101: Name Validation
This regex matches only when all the following are true: password must contain 1 number (0-9) password must contain 1 uppercase letters password must contain 1 lowercase letters password must contain 1 non-alpha numeric number password is 8-16 ...