Operators |
tuple_regexp_replace — Replace a substring using regular expressions.
tuple_regexp_replace( : : Data, Expression, Replace : Result)
tuple_regexp_replace applies the regular expression in Expression to one or more input strings in Data, and replaces the first matching substring using the Replace expression. For each input string, a processed output string is returned in Result.
Please refer to the documentation of tuple_regexp_match for syntax and options of regular expressions. Additionally, tuple_regexp_replace supports the option 'replace_all' , which causes all matches within each individual string to be replaced.
The Replace expression may use the tag '$0' to refer to the matched substring in the input data, '$i' to refer to the submatch of the i-th capturing group (for i <= 9), and '$$' to refer to the '$' literal.
For general information about string operations see Tuple / String Operations.
If Data is an empty tuple, the operator returns an empty tuple. If Replace is an empty tuple and Data is not empty, an exception is raised.
HDevelop provides an in-line operation for tuple_regexp_replace , which can be used in an expression in the following syntax:
Result := regexp_replace(Data, Expression, Replace)
Input strings to process.
Regular expression.
Default value: '.*'
Suggested values: '.*' , 'replace_all' , 'ignore_case' , 'multiline' , 'dot_matches_all' , 'newline_lf' , 'newline_crlf' , 'newline_cr'
Replacement expression.
Processed strings.
tuple_regexp_replace(['img10.bmp','img11.bmp','img12.bmp'], \ 'img(.*).bmp', 'out$1.txt', Result) * Returns ['out10.txt','out11.txt','out12.txt']
tuple_regexp_match, tuple_regexp_test, tuple_regexp_select
Foundation
Operators |