Please enable JavaScript to use regex101
/
^
r
e
g
e
x
[
\
-
_
]
?
1
0
1
$
/
i
Reg
ular
Ex
pressions
101
Upgrade to Pro
Enterprise
Community Library
How to contribute
x
Personal name (unicode)
Open Workspace
PCRE (Legacy)
Match
Created 2017-05-03 12:23
0
Regular Expression
/
^
(?!
[
\x20\x27\x2D
]
|
.
*?
[
\p{Lu}
]
{2}
|
.
*?
[
\x20
]
{2}
|
.
*?
[
\x27
]
{2}
|
.
*?
[
\x2D
]
{2}
|
.
*?
(
\x20\x2D
|
\x2D\x20
)
|
.
*?
(
\x27\x2D
|
\x2D\x27
)
|
.
*?
(
\x27
[
\w
]
+
\x27
(
\x20
|
$
)
)
)
[
\p{L}\x20\x27\x2D
]
+
$
(?<!
[
\x20\x2D
]
)
/
gm
Description
Validates personal names.
Conditions:
Must contain only letters (any unicode letter), spaces, apostrophes and hyphens
Must not start with a space, an apostrophe or a hyphen
Must not contain consecutive uppercase letters
Must not contain consecutive spaces
Must not contain consecutive apostrophes
Must not contain consecutive hyphens
Must not contain a space before or after a hyphen
Must not contain an apostrophe before or after a hyphen
Must not contain enclosing apostrophes ('single quote' style)
Must not end with a space or a hyphen
Must contain at least one character
Submitted by
Mattias Larsson