Select tables whose names match a regular expression.
tbl_matches(
pattern,
case_sensitive=False,
)
tbl_matches() selects the tables whose names match the regular expression pattern=. As with the column selector matches(), a name matches when the pattern is found anywhere in it (as with re.search()), so use ^ and $ to match a whole name (e.g., r"^(customers|orders)$" selects exactly those two tables, while "customers|orders" would also select customers_archive). Like the other table selectors, it’s used in the applies_to= argument of a Standard or of Standard.apply(). The name tested is the table’s own name, without a schema or a file extension.
Parameters
pattern: str
-
The regular expression that a table’s name must match.
case_sensitive: bool = False
-
Whether the matching is case-sensitive. The default is
False.
Returns
TableSelector
-
A table selector, which can be combined with other table selectors with
& (and), | (or), - (difference), and ~ (not).
Raises
ValueError
-
If
pattern= isn’t a valid regular expression.
Examples
Monthly extracts are often named with the year and month. This selector finds the extracts of 2026:
import pointblank as pb
import polars as pl
tables = {
"sales_2025_12": pl.DataFrame({"amount": [10.0]}),
"sales_2026_01": pl.DataFrame({"amount": [12.5]}),
"sales_2026_02": pl.DataFrame({"amount": [9.0]}),
"sales_summary": pl.DataFrame({"amount": [31.5]}),
}
sales_standard = pb.Standard(
name="monthly-sales",
steps=[pb.Step("col_vals_ge", columns="amount", value=0)],
applies_to=pb.tbl_matches(r"^sales_2026_\d{2}$"),
)
sales_standard.find_tables(tables)
['sales_2026_01', 'sales_2026_02']
The extract of December 2025 and the summary table don’t match the pattern.