CppCon 2018: Hana Dusíková “Compile Time Regular Expressions”

Channel:CppCon · Length:54:48 · Published:2018-10-24 · Views:14312

Watch on YouTube

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