by burntsushi on 9/14/23, 7:50 PM
I'd love for someone to add this to rebar[1] so that we can get a good sense of how well it does against other general purpose regex engines. It will be a little tricky to add (since the build step will require emitting a C++ program and compiling it), but it should be possible.
[1]: https://github.com/BurntSushi/rebar
by daemin on 9/14/23, 11:59 PM
It's a good library but be careful as it can significantly increase compile times. I added a couple of reasonably long regular expressions to a c++ source file and it increased the compile time from near instant (below to 1 second) to 30 seconds. Might be wise to move these to dedicated source files so you don't pay this penalty each time you make changes.
by nly on 9/14/23, 11:08 PM
by arunc on 9/15/23, 4:06 AM
by arijun on 9/14/23, 11:57 PM
At the risk of sounding like an idiot, what is the benefit of being able to match at compile time?
by cracauer on 9/14/23, 8:24 PM
C++ finally catches up to Perl :-)
by emmanueloga_ on 9/14/23, 10:20 PM
Since people is posting other lang implementations... someone did it for zig too (probably less polished than this C++ lib) [0]. It is nice that the regexes can be used at compile time too [1].
--
0: https://github.com/alexnask/ctregex.zig
1: I think the difference between C++ template language and Zig comptime is that Zig's comptime is almost equal as Zig's regular language, whereas the experience of programming C++ templates almost feels like learning a separate, equally complex language.
by nemoniac on 9/14/23, 9:14 PM
by docandrew on 9/14/23, 7:19 PM
by ape4 on 9/14/23, 7:12 PM
Hopefully the standard regex will be constexpr soon.