camel case

Split Camel Case String in Python

import re

def camel_case_split(identifier):
    matches = re.finditer('.+?(?:(?<=[a-z])(?=[A-Z])|(?<=[A-Z])(?=[A-Z][a-z])|$)', identifier)
    return [m.group(0) for m in matches]

Reference: https://stackoverflow.com/a/29920015/1936697

Advertisements