replace-text-in-list

Finds and replaces one or more occurrences of a text in a list.

Within a list, searches each text value for a specific pattern, and replaces one or all matches with a replacement text. The pattern can be a text or a regular expression. If pattern is a text, only the first occurrence will be replaced. If pattern is RegEx, all occurrences will be replaced.

Arguments

Inputs:

list: The text to be replaced or a regular expression describing it. Regular expressions must be wrapped with / character (e.g. /.*/). Capture groups can be used by the replacement field (e.g. as $1, $2 etc).

pattern: The text or a regular expression to be replaced. Regular expressions must be wrapped with / character (e.g. /.*/

replacement: The text that replaces the substring specified by the specified pattern parameter. If unspecified, matches will be replaced with a blank text (i.e. \\").

Output:

list: The list with values modified as specified.

Last updated