Pattern matching compares strings with wildcard or regular-expression patterns, making it useful for filtering data by text conditions. section 6.2.2
DuckDB supports four pattern-matching approaches:
- LIKE matches an entire string with % and _ wildcards. section 6.2.2
- SIMILAR TO matches an entire string against a regular expression. section 6.2.2
- GLOB matches filename-like patterns; regular-expression functions provide a general alternative. section 6.2.2
Find Eastern European countries
Filter the Region column with a regular expression, then intersect the result with countries whose population exceeds 10 million. The result contains Czech Republic, Poland, and Romania. section 6.2.2
eastern_europe = population_table \
.filter("Region ~ '.*EASTERN EUROPE.*'")
A runnable DuckDB relational expression filters Region values containing EASTERN EUROPE. section 6.2.2











