From ed630ccd773de6185edb0f00d52c180da5cde2a5 Mon Sep 17 00:00:00 2001 From: gillibrand Date: Thu, 24 Mar 2022 20:21:03 -0700 Subject: [PATCH] Some inner letters are uppercase when using titlecase Titlecase has an allow list of known acronyms that alwasys remain all uppercase. They were being matched within words though, so "previous" became "PrevIOUs" (since IOU is uppercase). Changed the match to only occur on word boundaries. --- changecase.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/changecase.py b/changecase.py index 6622d73..201e006 100644 --- a/changecase.py +++ b/changecase.py @@ -15,9 +15,9 @@ if len(text.strip()) == 0: sys.exit(0) -always_uppercase = r'''\bXML|HTML|CSS|JSON|FYI|AOL|ATM|BBC|CD|FAQ|GAIM|GNU|GTK|HIRD|HIV - |HURD|IEEE|IOU|IRA|IUPAC|JPEG|LCD|NAACP|NAC|NATO|NCAA|NOAD|OEM|PHP|ROM|SAT|SFMOMA|SQL|USA|VHDL|VHSIC|W3C - |LOL|WTF\b''' +always_uppercase = r'''\b(?:XML|HTML|CSS|JSON|FYI|AOL|ATM|BBC|CD|FAQ|GAIM|GNU|GTK|HIRD|HIV + |HURD|IEEE|IOU|IRA|IUPAC|JPEG|LCD|NAACP|NAC|NATO|NCAA|NOAD|OEM|PHP|ROM|SAT|SFMOMA|SQL|USA|VHDL|VHSIC|W3C + |LOL|WTF)\b''' always_uppercase_re = re.compile(always_uppercase, re.I | re.X)