Jason Friedman <jsf80...@gmail.com> wrote:
>Would this not work?
>import re
>if re.search(r"\d{1,2}:\d{2}:\d{2}(.\d{1,3})?", "12:55:55.705"):
>    # It's a time

No, because this regexp also matches stuff like "99:99:99.999".
Checking for the number of digits is not enough, because not all
combinations of two digits are valid hours, minutes or seconds.

Bye, Andreas
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to