Common Regular Expressions Made Simple
github.com
github.com
That project shows there are two tracks by which to tackle the problem that regex syntax is incoherent gobbledygook. The first is creating a regex version of pho with 5000 functions and mix and match names piece by piece. The second is to rename regex symbols to something that is easier for humans to parse.
(thanks for the verbal expressions link btw, seems really promising)
generally, very good.
This is an excellent point. Petty substitutions like verbal expressions might be useful if you're just getting started, but ultimately it's a crutch and it's best just to learn pure regular expressions. They're not that difficult.
Same with bundling a ton of dependencies. Lots of people (especially contemporary programmers, primarily web developers) seem to be deathly afraid of writing custom code to handle a job. It's not "reinventing the wheel", it's implementing logic easily extensible within your application without the hassle of upstream, especially if you're only using a small portion of a library or framework. Using 15 libraries for a 600-line script isn't best practice, it's cowardice.
> um 6:00 am 05.12. (at 6:00 on 12/05/..)
If i read it correctly, the time regex would extract "6:00 am" as time, but the "am" is wrong (German uses 24h format).
Simple regular expressions can be good enough if you're aware of the domain restriction though.
> There is always a well-known solution to every human problem — neat, plausible, and wrong.
often paraphrased as "For every complex problem there is an answer that is clear, simple, and wrong."
> Please note that this module is currently English/US specific.
I'm sure there are better alternatives than just regexp to validate numbers, emails ,etc ...
Of course further complexity is added in people being able to provide partial and context-dependent information, which is much harder to detect e.g. "December 3rd"