I am trying to convert camel case to space separated values using python. For example:

divLineColor -> div Line Color

This line does that successfully:

label = re.sub("([A-Z])"," \g<0>",label)

The problem I am having is with things like simpleBigURL they should do this:

simpleBigURL -> simple Big URL

I am not entirely sure how to get this result. Help!


This is one thing that I tried:

label = re.sub("([a-z])([A-Z])","\g<0> \g<1>",label)

But this produces weird results like:

divLineColor -> divL vineC eolor

I was also thinking that using the (?!...) could work but I have not had any luck.

Edit
Report