code: def matches(pattern: str) -> SelectorType:
      """
      Select all columns that match the given regex pattern.
  
      See Also
      --------
      contains : Select all columns that contain the given substring.
      ends_with : Select all columns that end with the given substring(s).
      starts_with : Select all columns that start with the given substring(s).
  
      Parameters
      ----------
      pattern
          A valid regular expression pattern, compatible with the `regex crate
          <https://docs.rs/regex/latest/regex/>`_.
  
      Examples
      --------
      >>> import polars.selectors as cs
      >>> df = pl.DataFrame(
      ...     {
      ...         "foo": ["x", "y"],
      ...         "bar": [123, 456],
      ...         "baz": [2.0, 5.5],
      ...         "zap": [0, 1],
      ...     }
      ... )
  
      Match column names containing an 'a', preceded by a character that is not 'z':
  
      >>> df.select(cs.matches("[^z]a"))
      shape: (2, 2)
      ┌─────┬─────┐
      │ bar ┆ baz │
      │ --- ┆ --- │
      │ i64 ┆ f64 │
      ╞═════╪═════╡
      │ 123 ┆ 2.0 │
      │ 456 ┆ 5.5 │
      └─────┴─────┘
  
      Do not match column names ending in 'R' or 'z' (case-insensitively):
  
      >>> df.select(~cs.matches(r"(?i)R|z$"))
      shape: (2, 2)
      ┌─────┬─────┐
      │ foo ┆ zap │
      │ --- ┆ --- │
      │ str ┆ i64 │
      ╞═════╪═════╡
      │ x   ┆ 0   │
      │ y   ┆ 1   │
      └─────┴─────┘
  
      """
      if pattern == ".*":
          return all()
      else:
          if pattern.startswith(".*"):
              pattern = pattern[2:]
          elif pattern.endswith(".*"):
              pattern = pattern[:-2]
  
          pfx = "^.*" if not pattern.startswith("^") else ""
          sfx = ".*$" if not pattern.endswith("$") else ""
          raw_params = f"{pfx}{pattern}{sfx}"
  
          return _selector_proxy_(
              F.col(raw_params),
              name="matches",
              parameters={"pattern": pattern},
          )
  
imports: from __future__ import annotations
  import re
  from datetime import timezone
  from functools import reduce
  from operator import or_
  from typing import TYPE_CHECKING, Any, Collection, Literal, Mapping, overload
  from polars import functions
  from polars.datatypes import FLOAT_DTYPES, INTEGER_DTYPES, NUMERIC_DTYPES, SIGNED_INTEGER_DTYPES, TEMPORAL_DTYPES, UNSIGNED_INTEGER_DTYPES, Binary, Boolean, Categorical, Date, Datetime, Decimal, Duration, Object, String, Time, is_polars_dtype
  from polars.expr import Expr
  from polars.utils.deprecation import deprecate_nonkeyword_arguments
  from polars.utils.various import is_column
label_desc: Use image node_id 28 for calling a global function with example usage: matches(pattern) and returns: all, _selector_proxy_