1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121
|
#Please insert up references in the next lines (line starts with keyword UP)
UP arb.hlp
UP glossary.hlp
#Please insert subtopic references (line starts with keyword SUB)
SUB reg.hlp
TITLE 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
SECTION 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'
SECTION 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 a database field named <key>
if this field does not exits then the string ''
'*(key#mystring)' the value of a database field named <key>
if this field does not exits then the string 'mystring'
'*(key\:nsrt)' invokes the SRT recursively on the value of the
database field 'key'
NOTE: All ':' have to be 'escaped'
'*([key]|ACI)' starts ACI (see LINK{aci.hlp})
on the value of '[key]' (which may be empty).
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
|