diff --git a/humps/main.py b/humps/main.py index 4e3844d..810c993 100644 --- a/humps/main.py +++ b/humps/main.py @@ -7,7 +7,7 @@ ACRONYM_RE = re.compile(r"([A-Z\d]+)(?=[A-Z\d]|$)") PASCAL_RE = re.compile(r"([^\-_]+)") -SPLIT_RE = re.compile(r"([\-_]*(?<=[^0-9])(?=[A-Z])[^A-Z]*[\-_]*)") +SPLIT_RE = re.compile(r"([\-_]*(?<=[^0-9_])(?=[A-Z])[^A-Z]*[\-_]*)") UNDERSCORE_RE = re.compile(r"(?<=[^\-_])[\-_]+[^\-_]") diff --git a/tests/test_humps.py b/tests/test_humps.py index 0217228..61a56d7 100644 --- a/tests/test_humps.py +++ b/tests/test_humps.py @@ -24,6 +24,7 @@ def test_converting_strings(): ("memMB", "mem_mb"), # Fixed issue #258 ("B52Thing", "b52_thing"), + ("B2BThing", "b2b_thing"), ], ) def test_camelized_acronyms(input_str, expected_output):