Macro Language Reference > Macros > Application > search
  
/
Description
Invokes PTC ALD search and replace feature to enable a search for text or, optionally, a search and replace for text
 
Example 7. Search and replace TeX
The code below will search for any entry in the form \item[???] and replace it with <item id=???>:
/\\\\item\[([^\93\]*)]/<item id=\\1>/tcirg
 
Example 8. Replace characters using search and replace
The syntax below will replace the words 'Hotel du lac' (which , for the sake of argument, 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?
Syntax
/ search:b '/' replace:b? '/' options:b
search
The text for which to search
 
Special characters are entered as a numeric value within two \ characters as follows:
Hard return - -\10\
Quad centre - - \258\
Table Cell break - -\270\
Wildcards are entered as a ? character and can be used in the search if they have been activated by including a ? in the options parameter.
replace
The string with which replace the search text: in the same format as the search parameter. Wildcards are entered as a ? character and can be used in the search if they have been activated by including a ? in the options parameter.
options
t
Start the search from the top of the current text stream.
g
Carry out search and replace globally, i.e. on every matching instance within the current text stream from the start position.
a
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 the type of text tag in which to search and replace.
e
Move text cursor to end of search text.
s
Select search text.
c
Search by character, i.e. include PTC ALD codes when searching.
b
Search backwards.
i
Ignore case, i.e. treat 'A' and 'a' in the same way.
q
Query replace.
z
Display statistics of search
?
Treat any ? characters in the search text as wildcards.
num
Instruct PTC ALD 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
r
Include regular expressions - normal
x
Include regular expressions - eXtended
Additional Information
* 
The ttrack macro is useful as a way of taking you to the right page after a search.
* 
Each search field is limited to 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.
Related Links