Following a set of numbers I would like to add a space to the string. For instance, the following strings should add a space after a number:
Before After
"0ABCD TECHNOLOGIES SERVICES" "0 ABCD TECHNOLOGIES SERVICES"
"ABCD0 TECHNOLOGIES SERVICES" "ABCD 0 TECHNOLOGIES SERVICES"
"ABCD 0TECHNOLOGIES SERVICES" "ABCD 0 TECHNOLOGIES SERVICES"
"ABCD TECHNOLOGIES0 SERVICES" "ABCD TECHNOLOGIES 0 SERVICES"
"ABCD TECHNOLOGIES 0SERVICES" "ABCD TECHNOLOGIES 0 SERVICES"
"ABCD TECHNOLOGIES SERVICES0" "ABCD TECHNOLOGIES SERVICES 0"
I have been trying to work on regex in Python as in the following way:
text= re.sub(r'([0-9]+)?([A-Za-z]+)?([0-9]+)?',
r'\1 \2 \3',
text,
0,
re.IGNORECASE)
With the previous code I am getting undesired spaces which are affecting other regex transformation:
"0 abcd technologies services "
How can I get the addition of space in the string without adding undesired spaces?