±replace
Replaces parts of a CSV table field with a replacement expression
Description
Partially replaces certain sections of a data field with replacement content.The old and the new content are separated by a slash separator ("/").
The replacement pairs are then separated by commas.
Do not forget to escape all brackets and other special characters in old and replacement content by prepending a backslash, see also Placeholders . But see the exception when replacement is defined numeric.
The current as well as the replacement content can be a literal string, some field content, or a more complex expression.
The expressions of both sides are resolved before replacement takes place.
When you do several replacements in one ±replace command, they will be done simultaneously. There is no sequence of provcessing. If you want to replace "Cat" by "Dog" and "Dog" by "Cat", both replacements will happen independently and there will be no interference between them.
Therefore, if some special effect is aimed in doing replacements in a certain order, several ±replace commands must be used one after the other.
When more data fields are given as a comma-separated list, then all replacements will be applied to all of the data fields.
You can also replace more than one content part with a common replacement. To achieve this, all parts to replace, as well as the replacement, are concaternated with a slash, the last part of this combination is then interpreted as the replacement.
Pattern
±replace[Field]=OldContent/NewContent,OldContent/NewContent,...
±replace[Field],[Field],[Field]=OldContent/NewContent,OldContent/NewContent,...
±replace[Field]=OldContent/OldContent/OldContent/NewContent,...
bla
Modes:
a: (default) the replacement expression contains the string that to be replaced by another string. The replacement is case-sensitive.
-replace[field]/a=OldContent/NewContent
i: ignore case
-replace[field]/i=OldContent/NewContent
n: numeric, instead of the string to replace, the replacement ist defined via start position and length of the part that shall be replaced by another string.
The start position begins with 1.
The start and stop information should be enclosed with brackets to hide the comma from the comma-separated list.
-replace/n[field]=(3-8)/NewContent replaces the characters from position 3 to 8 with the new content.
-replace/n[field]=(3,8)/NewContent replaces 8 characters, starting from position 3.