3 ms·
Common Lisp had something like this for ages in CL-PPCRE library, with the added benefit of not having to monkey with ".end()" and whatnot, because s-expression
by TeMPOraL 6y ago
Common Lisp had something like this for ages in CL-PPCRE library, with the added benefit of not having to monkey with ".end()" and whatnot, because s-expression syntax guarantees you always know what is enclosed by what.
Still, I came to the similar conclusion as you. It's sometimes nice to check a descriptive format if needed (CL-PPCRE can take a "standard" regex and translate it to its tree-based verbose notation), but it's a chore to type that up and it still requires you to understand how the grammar works. It's much easier to work with the standard notation.
And I mean - what's the big problem here? Regexes are so common and so useful that, in my opinion, any self-respecting developer should learn them to the point they feel comfortable with reading and writing them, with a manual on hand. If you want to make it easier to read, just split it up and comment it, be it with 'x' modifier or with string concatenation and your programming language's native comments.