Arbortext Command Language > Commands > find
  
find
find { -panel | [ -b | -f] [ -select | -noselect] [ -c | -noc] [ -word | -noword] [ -e | -noe] [ -entityscan | -noentityscan] [ -markup'<tagname>'|'<entity>' | -t'<tagname>' | -not] [ -in'tagname'] [ -wrapscan | -nowrapscan] [ -q | -noq] [ -graphic | -equation | -table | -s] [ -p] [ -r] [ -d] [/string/]} [ -alias | -noalias]
This command searches from the cursor in the specified direction (forward by default) for the first occurrence of the specified string (or the previous search string, if no string is specified). The search ignores generated text. The string you enter must be delimited by one of the standard delimiters.
To replace a string with a different string, use the substitute command.
-panel displays the Find/Replace dialog box.
-b searches backward.
-f (the default) searches forward.
-select (the default) highlights and selects the matched string.
-noselect positions the cursor at the end of the search string.
-c performs a case-sensitive search.
-noc (the default) finds a string regardless of how it is capitalized. The set case command sets this parameter for all subsequent searches.
-word (or -w) finds a string only when it matches a whole word.
-noword (or -now) matches strings even when they are part of a larger word
-e specifies that the search string is a regular expression. This means that some punctuation characters such as *, \, and . perform special functions. For example, in find -e /p..t/, the period . is a placeholder representing any character. The command would find “pret”, “port”, and “part”, as well as the string “p..t”.
-noe (the default) specifies that the search string is not a regular expression. The set expressions command sets this parameter for all subsequent searches.
-entityscan (-es) controls whether or not the find command will search the contents of entities.
-noentityscan (-noes) will prevent the search from including the contents of entities. For example, the command find -es /script would search for the word “script” and include entities. Setting this option overrides the set entityscan command.
-markup (-m) indicates that the search string contains one or more tags or entities. Tags are indicated by surrounding angle brackets; an end tag contains a slash. Entities start with an ampersand (&) and end in a semicolon (;). For example, to search for the end of an italic tag pair, you might enter find -m '</italic>'. To search for a copyright symbol, you might enter find -m '&copy;'. To search for a comment, you might enter find -m '<_comment>'. (Similar searches would locate processing instructions.)
If the set balancedselections is set to on, the command find -m '<tagname>' results in finding the start tag, content, and end tag of the next <tagname> element, with the cursor being placed directly after the end tag.
-t works like the -markup option except it does not find entities. This option is provided for backward compatibility; scripts should use the -markup option.
-not (the default) indicates the search string does not contain tags. The set tagscan command sets the default value for this parameter for all subsequent searches.
-in '<tagname>' searches the text within specified markup by specifying the tag name to search within .
-wrapscan (or -ws) causes the search to wrap to the beginning of the file when the end of the file is reached. -wrapscan is the default.
-nowrapscan (-nows) prevents the search from wrapping. The set wrapscan command sets the default value for this parameter for all subsequent searches.
-q (for “quiet”) suppresses the “string not found” message generated when a search fails. This is useful for putting the find command in command files or aliases.
-noq (the default) displays a message when Arbortext Editor cannot find a string that matches the search string.
-graphic (or -gr) searches forward to the next graphic in the document. Search strings are not permitted with the -graphic modifier.
-table (or -tab) searches to the next table in the document. Search strings are not permitted with the -table modifier.
-s searches for the next special element (graphic, equation, or table) in the document. Search strings are not permitted with the -s modifier.
-p searches to the tag at the end of the current document division (the parent tag). It can be combined with -b to move back to the beginning of a division. Search strings are not permitted with the -p modifier.
-r repeats the search in the opposite (reverse) direction. Search strings are not permitted with the -r modifier.
-d searches for the mate of the square bracket, curly brace, parenthesis, or double quote directly preceding the cursor; otherwise, it searches for the closest delimiter and positions the cursor next to its mate. Search strings are not permitted with the -d modifier.
-alias specifies that the search string can contain element aliases, but not real names, if an alias map has been applied to the document. The default is -noalias.
-noalias indicates that the search string cannot contain element aliases, even if an alias map has been applied to the document.
The set case, set expressions, set tagscan, set entityscan, set markupscan and set wrapscancommands can modify the behavior of the find command.
If you use the find command in a script, be sure to use a valid string delimiter for the search string. You must supply either a matching close delimiter or place the string at the end of a line. For instance, find /therefore if it is the end of a line and find /therefore/ are both valid. Using {find /therefore} as part of another command specification isn't valid because the curly brace is a command group delimiter, not a string delimiter. By supplying the closing delimiter /, the command specification {find /therefore/} is now valid.
Examples
find -b /and
f -f /and
f /therefore
f -c /Therefore
f -noc /therefore
f -e /gr.y
f -noe /grey/
f -m '</emphasis> hunting'
f -m 'Our Company Name&copy;'
f -not /hunting/
f -p
f -r
f -d
When the search text does not contain tags, the -markup option is not specified, or the set markupscan preference is off, then inline tags and processing instructions are ignored when matching text. If a tag starts or ends a line, it is considered a word boundary and also limits a text match. For example, the search text two words would match two <emphasis>words</emphasis>, but would not cross paragraph boundaries to match the following:
two</para>
<para>words
Elements suppressed by the tag_display command can be recognized and operated on by the find command by setting set hiddentagscan to on.
Related Topics
Using regular expressions
substitute command