I am trying to convert camel case to space separated values using python. For example:
divLineColor -> div Line Color
This lin
I couldnt get a really nice regex, but this worked decently.
([a-z]+)([A-Z][a-z]+)?([A-Z][a-z]+)?([A-Z][a-z]+)?([A-Z][a-z]+)?
Breaking it down it is:
([a-z]+) Any series of lowercase characters
([A-Z][a-z]+)? Any uppercase character followed by 1 or more lowercase characters. This is optional
Then I repeated the second group 4 times. This will only work if you dont have any more than 4 "sections" or uppercase characters. Add or take away that regex grouping as necessary. It will work if there less than this number (i.e. it will work on divLineColor) This will not match on words that are all uppercase.