regexp_like
Returns true if str matches the Java regex regexp, or false otherwise.
For the corresponding Databricks SQL function, see regexp_like function.
Syntax
Python
from pyspark.databricks.sql import functions as dbf
dbf.regexp_like(str=<str>, regexp=<regexp>)
Parameters
Parameter | Type | Description |
|---|---|---|
|
| Target column to work on. |
|
| Regex pattern to apply. |
Examples
Python
from pyspark.databricks.sql import functions as dbf
spark.createDataFrame(
[("1a 2b 14m", r"(\d+)")], ["str", "regexp"]
).select(dbf.regexp_like('str', dbf.lit(r'(\d+)'))).show()
Output
+-----------------------+
|REGEXP_LIKE(str, (\d+))|
+-----------------------+
| true|
+-----------------------+