From 369dbe312a93e4adb6a60799c95c0d3a56ac089e Mon Sep 17 00:00:00 2001 From: Mateen Ulhaq Date: Sun, 16 Mar 2025 14:33:53 -0700 Subject: [PATCH] fix: no underscores after numbers when converting to snake case --- src/betterproto/casing.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/betterproto/casing.py b/src/betterproto/casing.py index f7d0832b8..f281cc819 100644 --- a/src/betterproto/casing.py +++ b/src/betterproto/casing.py @@ -8,11 +8,11 @@ # Optionally capitalized word. # language=PythonRegExp -WORD = "[A-Z]*[a-z]*[0-9]*" +WORD = "[A-Z]*([a-z]|[0-9][A-Z]*)*" # Uppercase word, not followed by lowercase letters. # language=PythonRegExp -WORD_UPPER = "[A-Z]+(?![a-z])[0-9]*" +WORD_UPPER = "([A-Z]+(?![a-z])[0-9]*)+" def safe_snake_case(value: str) -> str: