fork download
  1. import re
  2. tests = ['0ABCD TECHNOLOGIES SERVICES',
  3. 'ABCD0 TECHNOLOGIES SERVICES',
  4. 'ABCD 0TECHNOLOGIES SERVICES',
  5. 'ABCD TECHNOLOGIES0 SERVICES',
  6. 'ABCD TECHNOLOGIES 0SERVICES',
  7. 'ABCD TECHNOLOGIES SERVICES0']
  8.  
  9. rx = re.compile(r'(?<=\d)(?=[^\d\s])|(?<=[^\d\s])(?=\d)')
  10.  
  11. for test in tests:
  12. print(rx.sub(' ', test))
Success #stdin #stdout 0.02s 9504KB
stdin
Standard input is empty
stdout
0 ABCD TECHNOLOGIES SERVICES
ABCD 0 TECHNOLOGIES SERVICES
ABCD 0 TECHNOLOGIES SERVICES
ABCD TECHNOLOGIES 0 SERVICES
ABCD TECHNOLOGIES 0 SERVICES
ABCD TECHNOLOGIES SERVICES 0