pyspark.sql.Column.rlike#

Column.rlike(other)[source]#

SQL RLIKE expression (LIKE with Regex). Returns a boolean Column based on a regex match.

Changed in version 3.4.0: Supports Spark Connect.

Parameters
otherstr

an extended regex expression

Returns
Column

Column of booleans showing whether each element in the Column is matched by extended regex expression.

Examples

>>> df = spark.createDataFrame(
...      [(2, "Alice"), (5, "Bob")], ["age", "name"])
>>> df.filter(df.name.rlike('ice$')).collect()
[Row(age=2, name='Alice')]