Google
More docs on the ARB website.
See also index of helppages.
Last update on 04. Mar 2022 .
Main topics:
Related topics:

Search and Replace Tool (SRT)

DESCRIPTION  

The String Parser is used to search and replace substrings.

 

OCCURRENCE  

TREE/Species/Search:PARSE FIELD

TREE/Properties/NDS

 

SYNTAX  

'search=replace'        means search all occurrences of 'search'
                        and replace it by 'replace'

Different search/replace commands can be separated by ':':

'search1=replace1:search2=replace2: ... :searchn=replacen'
 

SPECIAL CHARACTERS  

Search && Replace string:

':'                separates two commands
'='                separates the search from the replace string
'\'                Escape symbol
'\\'               the '\' symbol itself
'\n'               newline
'\t'               tabulator
'\:'               ':'
'\='               '='
'\?'               '?'
'\*'               '*'

Search string:

'?'                single letter wildcard
'*'                multi letter wildcard

Replace string:

'?'                a reference to the corresponding single
                   letter wildcard in the search string
                   (if no digit or '(' follows).
'?n'               n = { 1,...,9 }
                   a reference to the n'th single letter wildcard
                   in the search string
'*'                a reference to the corresponding multi
                   letter wildcard in the search string
                   (no digit or '(' follows).
'*n'               n = { 1,...,9 }
                   a reference to the n'th multi letter wildcard
                   in the search string
'*(key)'           the value of the database field named 'key' (or '' - see below)
'*([key]#default)' value of DB field 'key' (if empty or missing -> return 'default')
'*([key]\:nsrt)'   invokes the SRT recursively on the value of DB field 'key' (or on '')
                   (Note: all ':' have to be escaped using '\')
'*([key]|ACI)'     invokes ACI (see ´ARB Command Interpreter (ACI)´) on the value of DB field 'key' (or on '')
        
Note: all above "*(key...)"-constructs read the content of DB field 'key'. If no fieldname is specified (possible where '[key]' is used in the description above) or if the field does not exists, an empty string is used instead.
 

EXAMPLES  

'p?r=p?w'

replaces all    par to paw
                pbr to pbw
                pcr to pcw ...

'p??r=p?2?1r'

swaps the two letters between p and r

'a*=b*'

replaces only the first 'a' by 'b'

'?* *=?. *2'

Replaces the first word by its first letter + '.'

'\:=\n'

replaces all ':' by <newline>

'*=* *(key1)'

appends the database field <key1>. if <key1> does not exists append nothing

'*=* *(key1#no info)'

appends the database field <key1> if <key1> does not exists append 'no info'

'*=*(key2\: =)'

The value of 'key2' with all spaces removed

'*=*(key2|remove(.-))'

the value of the database entry 'key2', but all '.' and '-' characters removed
 

WARNINGS  

Be careful when search or replace string contain special characters (such as ':'). Avoid to write too complicated commands.

 

BUGS  

None