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, NaTType, float64, list, tuple, dict]) Column [source] (https://github.com/snowflakedb/snowpark-python/blob/v1.16.0/src/snowflake/snowpark/functions.py#L2654-L2681)¶
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 | ------------