1
I want to remove numbers in the middle of letters, but I do not want to remove all numbers from the text, example:
Vini12cius
I want to turn into Vinicius
, but without changing a possible CPF that will come after, I created the following regex:
r = re.sub(r'([0-9])','',"")
But he eliminates all the text numbers, even those that are not between characters, I also tried:
r = re.sub(r'([a-z]*[0-9]*[a-z])','',"")
But I didn’t succeed either.
Keeping the
[a-z]
within the parentheses, you catch them together, making them also replaced. Review your capture group. Taking advantage, what were things like "123foo" or "foo123"? Should replace or not?– Woss
yes, in these cases can be removed, my problem is in the numbers that are alone, as I do not wish them to be removed
– HV Lopes