Please enable JavaScript to use regex101
/
^
r
e
g
e
x
[
\
-
_
]
?
1
0
1
$
/
i
Reg
ular
Ex
pressions
101
Reg
ular
Ex
pressions
101
Upgrade to Pro
Enterprise
Regular Expression
/
(\b(?'first_word'[a-z](?!([[:alnum:]]*_)(?# the word doesn't contain underscores))(?:[a-z0-9]*)))|(\G(?'trailing_word'[A-Z][a-z0-9]*))
/
gm
Input 1
1
New
camelCase camel camelCaseCase camel684Case ca45melCase camelCase6523Case camelCaseCaseCaseCaseCase camelCCase PascalCase // some random commentary with Capitalized letters camel_Snake_Case
Substitution
\L${first_word}${trailing_word:+_\L${trailing_word}:}