replace()
Searches for an substring and replace its occurences with other substring.
string replace()
(
txt string,
search_strg string,
replace_strg string);
Description
The function searches for all occurences of a search_strg in
txt and replaces every occurence with replace_strg.
An error is signalled if search_strg is empty.
Parameters
txt –
Text to process.
search_strg –
Substring to search for txt.
replace_strg –
Substring to replace search_strg in txt.
Errors
SQLState |
Error Code |
Error Text |
Description |
XP001
|
XPF08
|
Empty string passed as argument 2 to XPATH function replace()
|
It is impossible to search for an empty substring. |
XP001
|
XPF14
|
The result of XPATH function replace() is too long
|
If the function replaces short substring with longer one, the result is longer than the original string and may exceed 10Mb limit. |
Examples
Replace all occurences of 'http://www.example.com/' with '/webrobot/'
replace(
'<A HREF="http://www.example.com/index.html">Home</A>',
'http://www.example.com/', '/webrobot/' )