Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Returns true if str matches the Java regex regexp, or false otherwise.
For the corresponding Databricks SQL function, see rlike operator.
Syntax
from pyspark.databricks.sql import functions as dbf
dbf.rlike(str=<str>, regexp=<regexp>)
Parameters
| Parameter | Type | Description |
|---|---|---|
str |
pyspark.sql.Column or str |
Target column to work on. |
regexp |
pyspark.sql.Column or str |
Regex pattern to apply. |
Examples
from pyspark.databricks.sql import functions as dbf
df = spark.createDataFrame([("1a 2b 14m", r"(\d+)")], ["str", "regexp"])
df.select('*', dbf.rlike('str', dbf.lit(r'(\d+)'))).show()
+---------+------+-----------------+
| str|regexp|RLIKE(str, (\d+))|
+---------+------+-----------------+
|1a 2b 14m| (\d+)| true|
+---------+------+-----------------+