Lưu ý
Cần có ủy quyền mới truy nhập được vào trang này. Bạn có thể thử đăng nhập hoặc thay đổi thư mục.
Cần có ủy quyền mới truy nhập được vào trang này. Bạn có thể thử thay đổi thư mục.
Returns true if str matches the Java regex regexp, or false otherwise.
For the corresponding Databricks SQL function, see regexp operator.
Syntax
from pyspark.sql import functions as dbf
dbf.regexp(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.sql import functions as dbf
spark.createDataFrame(
[("1a 2b 14m", r"(\d+)")], ["str", "regexp"]
).select(dbf.regexp('str', dbf.lit(r'(\d+)'))).show()
+------------------+
|REGEXP(str, (\d+))|
+------------------+
| true|
+------------------+