6 ms·
Its my opinion that when a regex gets this complicated it should be hand-coded as a state machine parser.
by dana321 7y ago
Its my opinion that when a regex gets this complicated it should be hand-coded as a state machine parser.
- Terretta 7y agoComplicated != complex ... it’s a straightforward expression. My experience is regex seems like line noise to people. If you show them the multi line commented form they get it, and can then appreciate the one liners. I’ve thought a neat IDE trick would be doing that expansion, into this visualization followed by multi line text you edit, and a column to paste sample text into and see matching / back-refs / captures happen. Stays one liner in code. Standalone tools do it, slicker if inline.
- qtplatypus 7y agoState machine parsers are more difficult for most people to understand.