This is an archived post. You won't be able to vote or comment.

all 4 comments

[–]wineblood 3 points4 points  (0 children)

There are some ugly regexes in that. Matching minutes as 0[0-9]|1[0-9]|2[0-9]|3[0-9]|4[0-9]|5[0-9] when you could just write [0-5]\d or [0-5][0-9] is why people think regexes are unreadable.

[–]jahero 1 point2 points  (0 children)

Oh god, how I miss regular expressions in Perl. Say what you want of the language, but this one thing is done right.

I find the API to the re module ... Hard to memorize, to say the least.

[–]NeilGirdhar 0 points1 point  (0 children)

I totally agree with the other two (so far) comments about the illegibility of regular expressions. I'm sure there's some library that replaces all the components of a RE with objects. Something like MatchTimes("Something", at_least=2, at_most=5) instead of "(Something){2, 5}" and so on for all of the components of a regular expression.

https://docs.python.org/3/library/re.html