by Marcel Garus · 1 minute read · available at

Marcel Garus

Enfieldstr. 85
45966 Gladbeck
+49 15751770663

This website contains links to external websites – mainly the URLs redirect to external websites. In general, I do not have control over their content. Therefore, I do not accept any liability for this third-party content. The respective provider or operator is ultimately responsible for the content of the linked pages.

Thanks for reading!

If you liked this article, feel free to share it using this shortlink:

By the way, I wrote other articles about interesting topics. Here's an article I recommend:

Meta Strings

2022-02-22 · 2 minute read · programming language design

Most programming languages have the concept of a string, a representation of text in the program. In some languages, you can even integrate code expressions in strings:

"Hello, {name}!\n"

Special characters like { or \ indicate that the following characters are not part of the string literal itself, but should instead be interpreted in a different way – they are escape sequences.

This approach comes with some problems: Now, to actually use { or \ in the string, you have to escape those as well. This is okay, but makes strings with lots of special characters ugly. For example, to the regex that matches words ending with \ can be written like \w\\+, but inside a string it becomes even more bloated: