Re:Regexper – Regular expressions visualizer
by lalaithion on Tuesday January 30, 2018 @02:17PM
(#16268072)
Parsing combinators are the API you want.
The above is a Haskell function that does the parsing required above, returning the alphanumeric characters if the parse succeeds and returning an error if it does not. You may not speak Haskell, but this is probably still more readable than (n) => {new RegExp(`T\s(\w{${n}}\w)\s*=`)}, which is the Javascript function that does a similar thing.
[ Parent
| on HN ]
Re:Regexper – Regular expressions visualizer
by xfer on Tuesday January 30, 2018 @04:49PM
(#16269391)
But are they as efficient as regexp? I personally prefer regexp combinators.
Re:Regexper – Regular expressions visualizer
by lalaithion on Wednesday January 31, 2018 @01:04AM
(#16271823)
Optimizing them is a bit more work, but they can outperform hand-rolled C code: