3 ms·
We (the Hyperscan team) have spent a lot of time staring at regular expressions over the years (shameless plug: https://github.com/01org/hyperscan https://githu
by glangdale 10y ago
We (the Hyperscan team) have spent a lot of time staring at regular expressions over the years (shameless plug: https://github.com/01org/hyperscan https://github.com/01org/hyperscan).
I think a better format for regex is long overdue, but this isn't it. It's way too verbose (other commentators also noticed the resemblance to COBOL). I'm picturing a Snort/Suricata rule with this format regex, and you've now doubled the amount of screen real estate per rule.
The real problems with regex readability are (1) the lack of easily grasped structure, so it's almost impossible to spot the level at which a sequence or alternation operates (PCRE's extended format and creative tabbing can help) and (2) the total lack of abstraction - so if you have a favorite character class or subregex you write it approximately a bazillion times.
- SonOfLilit 10y agoI'd love to hear your feedback on my approach, that focuses on the kind of problems I read in your comment. http://www.slideshare.net/AurSaraf/re3-modern-regex-syntax-with-a-focus-on-adoption http://www.slideshare.net/AurSaraf/re3-modern-regex-syntax-w... https://github.com/sonoflilit/re2 https://github.com/sonoflilit/re2
- qwertyuiop924 10y agoSRE might help. It's pretty nice, if you like parens.