You are viewing documentation about an older version (1.12.1). View latest version

snowflake.snowpark.functions.regexp_count

snowflake.snowpark.functions.regexp_count(subject: Union[Column, str], pattern: Union[Column, str], position: Union[Column, int] = 1, *parameters: Union[Column, None, bool, int, float, str, bytearray, Decimal, date, datetime, time, bytes, list, tuple, dict]) Column[source]

Returns the number of times that a pattern occurs in the subject.

Example:

>>> df = session.sql("select * from values('apple'),('banana'),('peach') as T(a)")
>>> df.select(regexp_count(col("a"), "a").alias("result")).show()
------------
|"RESULT"  |
------------
|1         |
|3         |
|1         |
------------
Copy