Xbasic
Filter_String_Smatch_Change Function
Syntax
C result = C FILTER_STRING_SMATCH_CHANGE(C string ,C pattern,C changes[,C delimiter]])
Arguments
- result
The transformed string.
- string
The string in which to search.
- pattern
The pattern that defines which words (lines in the case where the delimiter is CR-LF) to replace.
- changes
A delimited list of words (lines in the case where the delimiter is CR-LF) to replace the words (or lines) selected by the pattern.
- delimiter
The delimiter between words in the string. Character
Description
Change words (lines) of text that match a pattern.
Discussion
Change words (lines) of text that match a pattern. Combines Filter_string_smatch() and stritran_multi() into a single, more efficient function call.
Example
input = <<%str% A|one C|one A|two B|one A|three B|two B|three C|two %str% replace = <<%str% A|une A|deux A|trois %str% dim changed as c changed = FILTER_STRING_SMATCH_CHANGE(input,"A|*",replace) ?changed A|une C|one A|deux B|one A|trois B|two B|three C|two 'In this example, the pattern selected these lines: A|one A|two A|three 'The replacement string replaced each line in the list of selected lines with 'the corresponding line in the replacement string.
See Also