ArborX


/

Longname: /   Open the Documentation Legend
Released: not available 
Created: not available 
See also: kud

Summary
Invokes Arbortext APP's search and replace feature, either searching for text or, optionally, searching for text and replacing it with some other text.
Example extract

Search for any entry in the form \item[???] and replace with <item id=???>.

 /\\\\item\[([^\93\]*)]/<item id=\\1>/tcirg

Syntax (SVNNA)
/ search:b   `/´ replace:b? `/´options:b
search:b

The text to search for. Special characters are entered by numeric value within two \ characters. Below are some examples:

Table Row break - \271\

Table break - \272\

Column break - \260\

Page break - \261\

Soft Return - \262\

Wildcards are entered as a ? character. If you are using wildcards you must also turn wildcards on by including a ? in the options parameter. For a full list see the 3B2 ISO character set User reference or Macro manual

replace:b The string to replace the search text with. This takes the same format as the search parameter. If wildcards are turned on in the options parameters, a ? can be used to refer to the character that matched a ? in the search text.
options:b
Start the search from the top of the current text stream.
Carry out search and replace globally, i.e. on every matching instance within the current text stream from the start position.
Extend search and replace actions to include all text streams in the current document, including reference streams, scripts, styles etc. This option can optionally be followed by a tag type code which denotes which type of text tag to search and replace in (see 3B2 tag types for a full list.
Move text cursor to end of search text.
Select search text.
Search by character, i.e. include Arbortext APP codes when searching.
Backwards.
Ignore case, i.e. treat 'A' and 'a' in the same way.
Query replace.
Display statistics of search
Treat any ? characters in the search text as wildcards.
num  A number to tell Arbortext APP how many times to carry out the search. This option is not available when the a option is used.
Insert 'replace' text
Append 'replace' text
Regular expressions - normal, see following section.
Regular expressions - eXtended

Regular expressions

Regular expressions are a powerful extension to the search and replace tool. There are many different operators used with the 'r' and 'r' options producing differing results for each one. Regular expression operators are discussed under Search and replace in the User Reference Manual Some useful examples are illustrated below.

Example

Regular expressions add a powerful extension to the conditional test macro see also Regular expressions_en.

The examples below illustrate some of the many options available using regular expressions.

 ?=/^var1,"[0-5]" }loop 4
 ?=/^string1,"[^a-zA-Z]" }num 6
 ?=/^name,"a.b" @Match is good 8
Example

Remove the fig refs from an entry such as, ...<figr figref="1">see figure 1</figr>... leaving just the text between them:

The syntax has been broken down into understanable sections below. This first section intructs Arbortext APP to search for <figr figref=", and then any character excluding a closing chevron >. The * means match the preceding regular expression as many times as possible before continuing with remainder of the pattern.

Now search for any characters until you see an opening chevron < there could be many characters before the next open chevron so the * is again present to repeat this search. The parenthesis are there to indicate this is a group that will be used later for the replacement text.

Replace the searched text with the result found in group 1.

 /<figr figref="[^>]*>([^<]*)<\47\figr>/\\1/tgciqr 6
 /<figr figref="[^>]*>... 8
 ...([^<]*)... 10
 /\\1/tgciqr 12
Example

The search and replace macro shown below uses several of these features, replacing the words 'Hotel du lac' (which we have noticed has also been typed in occasionally as 'hotel su lac') with the words 'Hôtel du Lac':

 /hotel ?u lac/Ho\170\tel du Lac/gi?
The ttrack macro is useful as a way of taking you to the right page after a search.
Each search field is limited 130 characters, so the total string has a length of only 260 characters. Beyond this amount you could make a simple script to select/cut/paste to your requirements. See 3B2 Scripting

Document created on 08-Feb-2003 (revision 1)