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

snowflake.snowpark.functions.regexp_count

snowflake.snowpark.functions.regexp_count(subject: ColumnOrName, pattern: ColumnOrLiteralStr, position: Column | int = 1, *parameters: ColumnOrLiteral) 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