general regex question... trying to add a dot whenever it switches between uppercase and lowercase, but it doesn't work 100%, what am I doing wrong? 🤔
>>> re.sub(r'([A-Z])([a-z])|([a-z])([A-Z])', r'\1\3.\2\4', 'THeqUiCKBrowNFoXjumpsOVErTHELAZYdog')
'TH.eq.Ui.CKB.row.NF.oX.jumps.OVE.rTHELAZY.dog'
I assume it doesn't process what was already matched
Обсуждают сегодня