[COFF] Requesting thoughts on extended regular expressions in grep.

Ralph Corderoy ralph at inputplus.co.uk
Fri Mar 3 20:59:28 AEST 2023


Hi Grant,

> What are the pros / cons to creating extended regular expressions like
> the following:

If you want to understand:

- the maths of regular expressions,
- the syntax of regexps which these days expresses more than REs, and
- the regexp engines in programs, the differences in how they work and
  what they match, and
- how to efficiently steer an engine's internals

then I recommend Jeffrey Friedl's Mastering Regular Expressions.
http://regex.info/book.html

> For matching patterns like the following in log files?
>
>     Mar  2 03:23:38

Do you want speed of matching with some false positives or validation by
regexp rather than post-lexing logic and to what depth, e.g. does this
month have a β€˜31st’?

    /^... .. ..:..:../

You'd said egrep, which is NDFA, but in other engines, alternation order
can matter, e.g. β€˜J’ starts the most months and some months have more
days than others.

    /^(J(an|u[nl])|Ma[ry]|A(ug|pr)|Oct|Dec|...

-- 
Cheers, Ralph.


More information about the COFF mailing list