regexp_replace
function
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
: ASTRING
expression to be matched.regexp
: ASTRING
expression with a matching pattern.rep
: ASTRING
expression 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
Related functions
Σχόλια
https://aka.ms/ContentUserFeedback.
Σύντομα διαθέσιμα: Καθ' όλη τη διάρκεια του 2024 θα καταργήσουμε σταδιακά τα ζητήματα GitHub ως μηχανισμό ανάδρασης για το περιεχόμενο και θα το αντικαταστήσουμε με ένα νέο σύστημα ανάδρασης. Για περισσότερες πληροφορίες, ανατρέξτε στο θέμα:Υποβολή και προβολή σχολίων για