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
🌐
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 - 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. There are millions of people with names who’ll successfully pass this regex.
Discussions

regular expressions - Best REGEX for first/last name validation? - Salesforce Stack Exchange
There is probably a more elegant way of doing this but I'm rather fresh to REGEX. ... Be careful when "validating" names. More on salesforce.stackexchange.com
🌐 salesforce.stackexchange.com
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
Match Full Name - Java Task (RegEx) - Q&A Mini Forum
Match Full Name - Java Task (RegEx) All categories · C# (85) PHP (49) Java (72) JavaScript (209) Web Development (51) SEO (0) Other (19) Match Phone Number - Java Task (RegEx) Jedi Code-X - Java Task · Series of Letters - Java Task (RegEx) How to use regex in Java? More on forum.tutorials7.com
🌐 forum.tutorials7.com
May 26, 2017
Validating a full name (allowing ' ', '-' and '`') and not start/endwith(- or `)
Can you please add Testcases that will Pass, and those that will Fail? More on reddit.com
🌐 r/pythonhelp
3
1
March 19, 2023
🌐
CodexWorld
codexworld.com › home › how to guides › how to validate first and last name with regular expression using javascript
How to Validate First and Last Name with Regular Expression using JavaScript - CodexWorld
April 15, 2023 - var regName = /^[a-zA-Z]+ [a-zA-Z]+$/; var name = document.getElementById('nameInput').value; if(!regName.test(name)){ alert('Invalid name given.'); }else{ alert('Valid name given.'); } The following code snippet shows how you can validate the ...
🌐
regex101
regex101.com › library › gK4eN5
regex101: Name Validation
RegEx email /^((?!\.)[\w-_.]*)(@\w+)(\.\w+(\.\w+)?)$/gim; Just playing with Reg Ex. This to validate emails in following ways The email couldn't start or finish with a dot The email shouldn't contain spaces into the string The email shouldn't ...
🌐
Regex Tester
regextester.com › 105925
Full Name - Regex Tester/Debugger
Full Name With atmost 3 words. ... Url checker with or without http:// or https:// Match string not containing string Check if a string only contains numbers Only letters and numbers Match elements of a url date format (yyyy-mm-dd) Url Validation Regex | Regular Expression - Taha Match an email address Validate an ip address nginx test Extract String Between Two STRINGS special characters check match whole word Match anything enclosed by square brackets.
Find elsewhere
🌐
RegExr
regexr.com › 3f8cm
RegExr: Learn, Build, & Test RegEx
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. Save & share expressions with others. Use Tools to explore your results. Full RegEx Reference with help & examples.
🌐
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 - We will then add support for Western European names followed by all human names covering North America, South America, Europe, Africa, Australia and Asia. We will also learn how to do fine grained control validation for different languages like Arabic or Russian. We will start by creating a simple NAME_REGEX regular expression in javascript which allows for "word" characters.
🌐
Tutorials7
forum.tutorials7.com › 1658 › match-full-name-java-task-regex
Match Full Name - Java Task (RegEx) - Q&A Mini Forum
May 26, 2017 - Match Full Name - Java Task (RegEx) All categories · C# (85) PHP (49) Java (72) JavaScript (209) Web Development (51) SEO (0) Other (19) Match Phone Number - Java Task (RegEx) Jedi Code-X - Java Task · Series of Letters - Java Task (RegEx) How to use regex in Java?
🌐
Regex Pattern
regexpattern.com › home › name validation regular expression
Name Validation Regular Expression - Regex Pattern
March 17, 2022 - Regex Pattern · Menu · A regular expression that matches and validates people’s names (first name, middle name, last name). /(^[a-zA-Z][a-zA-Z\s]{0,20}[a-zA-Z]$)/ Click To Copy · James · Kevin Wayne Durant · Dirk Nowitzki · Username Regular Expression ·
🌐
GitHub
gist.github.com › a-tokyo › 80dfebf1c85ac18179de02213ed50917
First name and last name validation for forms and databases using Regex. · GitHub
const NAME_REGEX = /^[a-zA-Z\xC0-\uFFFF]+([ \-']{0,1}[a-zA-Z\xC0-\uFFFF]+){0,2}[.]{0,1}$/ /** Validates a name field (first or last name) */ const isValidName = (name) => NAME_REGEX.test(name)
🌐
GeeksforGeeks
geeksforgeeks.org › java › how-to-validate-a-username-using-regular-expressions-in-java
How to validate a Username using Regular Expressions in Java - GeeksforGeeks
July 12, 2025 - According to the conditions, the ... way: ... "\\w{5, 29}" represents a check to make sure that the remaining items are word items, which includes the underscore, until it reaches the end and that is represented with $. The "{5, 29}" ...
🌐
PHPpot
phppot.com › javascript › validate-name-javascript
How to validate first name and last name in JavaScript? - PHPpot
February 11, 2024 - This quick example is not using any libraries. It simply defines the validateName(firstName, lastName) function. It receives the submitted first and last names from the form. It creates a Regex pattern that only allows alphabets, spaces, or ...
🌐
Salesforce
trailhead.salesforce.com › trailblazer-community › feed › 0D54S00000E9WUwSAN
Regex Formula For First Name Validation - Trailhead
December 19, 2021 - Skip to main content · TDX registration is open! Save $600 for a limited time and join the must-attend event to experience what's next and learn how to build it
🌐
Laasya Setty Blogs
laasyasettyblog.hashnode.dev › validating-username-using-regex
Validating Username Using REGEX. - Laasya Setty Blogs
November 28, 2020 - Input: Laasya_Setty 1Hashnode Output: Valid Invalid · import java.util.regex; import java.util.Scanner; public class Solution { public static void main(String[] args){ Scanner sc = new Scanner(System.in); String userName = sc.nextLine(); String regularExpression = "^[A-Za-z][A-Za-z0-9_]{7,29}$"; if (userName.matches(regularExpression)) { System.out.println("Valid"); } else { System.out.println("Invalid"); } } }
🌐
Regexlib
regexlib.com › Search.aspx
Search Results: 22 regular expressions found.
Regular Expression Library provides a searchable database of regular expressions. Users can add, edit, rate, and test regular expressions.
🌐
GitHub
gist.github.com › chrislachance › 287e3ebc530bc8ae4513a2e5e994e781
Regex pattern for Full name with space checking · GitHub
I modified it for use with Indian names (written in English) which may have multiple parts but never any special characters or names starting with small letters. ^[A-Z][a-z]+(\s[A-Z][a-z]?){0,} As a side effect it doesn't accept space as the ...