file_name_fixer.py
Thomas Heller
theller at python.net
Wed Jan 25 06:10:41 EST 2006
Richie Hindle <richie at entrian.com> writes:
> [Fredrik]
>> so re.sub("([_.])\\1+", "\\1", newname) replaces runs consisting
>> of either a . or an _ followed by one or more copies of itself, with
>> a single instance of itself.
>
> ...and this:
>
>>>> def isprime(n):
>>>> return n > 1 and not re.match(r'(xx+)\1+$', 'x'*n)
>
> finds prime numbers.
So, who will post a 'Pior' (Python in one regex)?
Thomas
More information about the Python-list
mailing list