>> >>>>> re.sub('[^0-9]', '', 'ab0c2m3g5') >> '0235' >> >> Possibly because there's a lot of good Python builtins that allow you >> to avoid the re module when *not* needed, it's easy to forget it in >> the cases where it does pretty much exactly what you want,
There is a LOT of overhead to figuring out how to use the re module. I've always though t it had it's place, but it sure seems like overkill for something this seemingly simple. If (a big if) removing "all but these" was a common use case, it would be nice to have a way to do it with string methods. This is a classic case of: Put it on PyPi, and see how much interest it garners. -CHB _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/