← All topics

5 articles in the notebook

Regex.

Template replacement engine

Regex.Replace with a match evaluator plus a case-insensitive dictionary makes a tidy single-pass template engine — faster and more flexible than chaining string.Replace calls.

C# Regex for verifying e-mails

The famous emailregex.com example is horrible, so I made my own C# email regex — loosely based on it, compiled, and good enough for most use cases.

Perl: Command-line regex

A few one-liners I keep reaching for: filtering and replacing with regex straight from the Perl command line, including in-place file editing with automatic backups.