Please enable JavaScript to use this web application.
Regular
Expressions
101
Social
Donate
Info
Regex Editor
Community Patterns
Account
Regex Quiz
Settings
Order By
Most Recent
Most upvotes
Most downvotes
Highest Score
Lowest Score
Filter by Flavor
PCRE2 (PHP >=7.3)
PCRE (PHP <7.3)
ECMAScript (JavaScript)
Python
Golang
Java 8
.NET 7.0 (C#)
Rust
Sponsors
There are currently no sponsors.
Become a sponsor today!
Community Patterns
Search among 15,000 community submitted regex patterns...
There does not seem to be anything here
Community Library Entry
1
Regular Expression
PCRE2 (PHP >=7.3)
/
(
\b
(?'first_word'
[
A
-
Z
]
(?!
(
[
A
-
Z0
-
9
]
*
\b
|
[
[:alnum:]
]
*
_
)
(?#
the
word
isn't
in
all
caps
and
doesn't
contain
underscores)
)
(?:
[
a
-
z0
-
9
]
*
)
)
)
|
(
\G
(?'trailing_word'
[
A
-
Z
]
[
a
-
z0
-
9
]
*
)
)
/
gm
Open regex in editor
Description
Works with many forms of alphanumeric PascalCase
PascalCase
Pascal
PascalCaseCase
Pascal684Case (pascal684_case)
Pas45calCase (pas45cal_case)
PascalCaseCaseCase (with as many words as you like)
PPascal (p_pascal)
PascalCCase (pascal_c_case)
What isn't matched
camelCase
words with '_' underscores in them (SCREAMING_SNAKE_CASE, Pascal_Snake_Case)
words without lowercase letters (ALLCAPS, ALL54CAPS)
Limitations
all 'Capitalized' words are matched and substituted to 'capitalized'
PascalCase with non-alphanumeric characters isn't matched
Submitted by
inesvar
-
10 months ago