php - Regex to match words and acronyms in camel case string -


i need regular expression capture word parts of string camel case , might have acronym in it. in other words, want split camel case string words , acronyms.

for example:

someabcwords

... has 3 capture groups

some abc words

so far i've found regex:

((?:^|[a-z])[a-z]+) 

but won't handle acronyms , match 'some' , 'words'.

one way solve capture abbreviations added negative lookahead.

[a-z][a-z]+|[a-z]+(?![a-z]) 

regular expression visualization

sample


Comments

Popular posts from this blog

mysql - Dreamhost PyCharm Django Python 3 Launching a Site -

java - Sending SMS with SMSLib and Web Services -

java - How to resolve The method toString() in the type Object is not applicable for the arguments (InputStream) -