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.
Applies to:
Databricks SQL
Databricks Runtime
Replaces all substrings of str that match regexp with rep.
Syntax
regexp_replace(str, regexp, rep [, position] )
Arguments
str: ASTRINGexpression to be matched.regexp: ASTRINGexpression with a matching pattern.rep: ASTRINGexpression which is the replacement string.position: A optional integral numeric literal greater than 0, stating where to start matching. The default is 1.
Returns
A STRING.
The regexp string must be a Java regular expression.
When using literals, use raw-literal (r prefix) to avoid escape character pre-processing.
Searching starts at position. The default is 1, which marks the beginning of str.
If position exceeds the character length of str, the result is str.
Examples
> SELECT regexp_replace('100-200', '(\\d+)', 'num');
num-num