Regular Expressions 101

Community Patterns

Search for word breaks in CamelCase string

1

Regular Expression
PCRE2 (PHP >=7.3)

/
(?<=[a-z])(?=[A-Z])|(?<=[A-Z])(?=[A-Z][a-z])
/
gm

Description

This finds the boundaries of words in a camel case string

Submitted by https://stackoverflow.com/questions/7593969/regex-to-split-camelcase-or-titlecase-advanced - 3 years ago