snowflake.snowpark.functions.regexp_like

snowflake.snowpark.functions.regexp_like(subject: Union[snowflake.snowpark.column.Column, str], pattern: Union[snowflake.snowpark.column.Column, str], parameters: Union[snowflake.snowpark.column.Column, str] = None) Column[source]

Returns true if the subject matches the specified pattern. Both inputs must be text expressions.

Parameters:
  • subject (ColumnOrName) – A string expression to be matched against the pattern.

  • pattern (ColumnOrName) – A string literal that will be used as a regular expression pattern.

  • parameters (ColumnOrName, optional) – A string literal that specifies the parameters for the regular expression, defaults: c.

  • values (Supported) –

    • c: Case-sensitive matching

    • i: Case-insensitive matching

    • m: Multi-line mode

    • e: Extract submatches

    • s: Single-line mode (POSIX wildcard character . matches n)

Returns:

A boolean value indicating whether the subject matches the pattern.

Return type:

Column

Examples::
>>> from snowflake.snowpark.functions import  col, lit
>>> df = session.create_dataframe([
...     ('Sacramento',),
...     ('San Francisco',),
...     ('San Jose',),
...     ('New York',),
...     (None,)
... ], schema=['city'])
>>> df.where(regexp_like(col('city'), lit('San.*'))).collect()
[Row(CITY='San Francisco'), Row(CITY='San Jose')]
>>> df.where(regexp_like(col('city'), lit('SAN.*'), lit('i'))).collect()
[Row(CITY='San Francisco'), Row(CITY='San Jose')]