CppCon 2018: Hana Dusíková “Compile Time Regular Expressions”
Channel:CppCon · Length:54:48 · Published:2018-10-24 · Views:14312
Summary
Hana Dusikova's CppCon 2018 talk presenting a C++ library that builds regular expressions from compile-time strings, using a C++20 feature. It avoids runtime parsing cost and covers implementation details, problems she hit, and benchmarks.
Why HN recommends it
Pointed to as the canonical presentation of compile-time regex in C++ and its template metaprogramming, including benchmark results.
A 54:47 presentation at CppCon 2018 is worth more than a thousand words — HN, 2025
C, C++, Rust, Go & systems languages · Compilers, interpreters & program analysis
Subtitles (excerpt)
- Good morning to you all. I'm so glad you are here and I'm so excited to stay here and if someone wants to switch with me, okay. Anyway, I'm going to talk about regular expressions. My name is Hana Dusikova, I work in Avast, I live in Brno, Czech Republic or Czechia, I'm organizing a local Avast C plus plus meetup, and I soon will be Czech national body for WG 21, and I'm an amateur photographer and ending in last week, I stop hiking. (people laughing) Bryce will tell you more. Okay, let's talk about regular expressions. What can I do with a regular expression? There are three things you can do with regular expression: match the subject against a pattern, you can extract the content of your subject, or you can modify parts of your subject, depends on algorithm expression used. You can do these things. For example, matching. This can be done with a definitive machine, a determinate definitive machine, which is much quicker than that search for extracting of content. Okay, regular expression looks like this pattern, A B C or zero to nine plus, which match correctors A B C or zero to nine. There are many dialects, ECMA, Perl, PCRE, name it. They are slightly different in more advanced feature,
On Hacker News
FYI: This is a C++ template version of compile time regex class. A 54:47 presentation at CppCon 2018 is worth more than a thousand words... see [VIDEO] followup CppCon 2019 video at [LINK] As the above github repo mentions, more info at [LINK] — canucker2016, 2025-11
One of the stated benefits is that the compiler optimizer can optimize the regex state machine that gets created, resulting in significantly faster match times at runtime. There are some benchmarks if you look up her cppcon talk about the library iirc. Edit: here is her talk, at 39 minutes she shares the benchmarks. [VIDEO] — lcvw, 2023-09
> Passing strings into a templates ... wouldn't work in C++ ... [VIDEO] Here's an example of parsing regular expressions in C++ at compile time. Code here: [LINK] — nikki93, 2020-09
Related videos
- Rich Harris - Rethinking reactivity · You Gotta Love Frontend · 36:45
- CppCon 2015: Andrei Alexandrescu “std::allocator...” · CppCon · 1:12:27
- Lexical Scanning in Go - Rob Pike · GoogleFOSSSydney · 51:17
- William Byrd on "The Most Beautiful Program Ever Written" [PWL NYC] · PapersWeLove · 1:31:05
- CppCon 2017: Matt Kulukundis “Designing a Fast, Efficient, Cache-friendly Hash Table, Step by Step” · CppCon · 59:33
- RustConf 2018 - Closing Keynote - Using Rust For Game Development by Catherine West · Rust Programming Language · 42:29
- CppCon 2016: Jason Turner “Rich Code for Tiny Computers: A Simple Commodore 64 Game in C++17” · CppCon · 1:19:52
- Clasp: Common Lisp using LLVM and C++ for Molecular Metaprogramming · Google TechTalks · 57:37
- Ideas about a new programming language for games. · Jonathan Blow · 1:55:24
- CppCon 2014: Mike Acton "Data-Oriented Design and C++" · CppCon · 1:27:46
- How I program C · Eskil Steenberg · 2:11:32
- Google I/O 2012 - Go Concurrency Patterns · Google for Developers · 51:27
- Compiling C to printable x86, to make an executable research paper · suckerpinch · 25:41
- Break Me00 The MoVfuscator Turning mov into a soul crushing RE nightmare Christopher Domas · Adrian Crenshaw · 46:19
- CppCon 2015: Kate Gregory “Stop Teaching C" · CppCon · 1:00:11
- Zig: A programming language designed for robustness, optimality, and clarity – Andrew Kelley · Recurse Center · 54:13