Advertisement
Guest User

Untitled

a guest
Apr 7th, 2021
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.17 KB | None | 0 0
  1. import re
  2.  
  3. input = "aaAaaBBaBBbbb"
  4. replace = r"\1_mysub_"
  5. n = 3
  6.  
  7. output = re.sub(r"^(.*?((?<=\w)[A-Z].*?){%s})(?<=\w)[A-Z]" % (n - 1), replace, input)
  8. print (output)
  9.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement