I have this string, I want to remove numbers that have two decimal places and also three decimal places, however, for numbers that contain two decimal places, I don't want to remove the first two numbers that are in the string, this is my code.
import re
string = "air max 12 x clot infantil 16 26 67 80 272 117 160"
regex = re.sub(r"\d{3}", "", string)
print(regex)
Well, notice that I can eliminate numbers that have 3 decimal places, but those that contain two I can't. Even if my code is this:
import re
string = "air max 12 x clot infantil 16 26 67 80 272 117 160"
regex = re.sub(r"\d{2,3}", "", string)
print(regex)
This works, the problem is that it will remove the first two numbers that have two decimal places, the output I wanted was:
import re
string = "air max 12 x clot infantil 16 26 67 80 272 117 160"
regex = re.sub(r"\d{2,3}", "", string)
//something here
print(regex)
Expected output
air max 12 x clot infantil
How can I do this using regex?