Here is my func:
@register.filter
def load_human_key(key):
"""
load util based on typ for key
return: More readable key
"""
regex = re.findall('[A-Z][^A-Z]*', key)
if regex:
joined_regex = " ".join(regex)
return joined_regex
return key
When I use load_human_key("JsonKey"). It works fine and returns Json Key, but when I use load_human_key("JsonKEY") it returns "Json K E Y"), which is not the behaviour i'd like to implement. Can sb help my function, so that load_human_key("JsonKEY") = load_human_key("JsonKey")? I am completly new to regex.
Thanks!