HP Search/XL User's Guide

3- 18
pattern in an indirect file, enclose the pattern in single quotation marks.
On the HP Search command line, you can specify both parameters that refer to only one pattern and
parameters that refer to a whole file of patterns. You may specify up to 16 patterns every time you use the
HPSEARCH command and each pattern may be up to 80 characters long.
Special Pattern-Matching Characters
HP Search has a pattern-matching facility that enables you to use wildcard and other special characters in
order to conduct more sophisticated pattern searches of your files. You can use any of the pattern-
matching characters whenever you specify a pattern.
Character HP Search Functionality
( ) Groups portions of a pattern. The main use of parentheses is with the vertical bar charac-
ter.
| Matches either the pattern on one side of the bar or the other. The bar character has spe-
cial meaning only when used inside parentheses, otherwise it is treated literally. That is,
the | character outside of parentheses matches only |.
[ ] Indicates a set of characters. HP Search attempts to match any one of the characters in
the set. You must always specify at least one character between left and right brackets;
otherwise, HP Search issues an error message.
- Signifies a range of alphanumeric characters starting with the character preceding the
hyphen and ending with the character following the hyphen. The hyphen character has
special meaning only when used inside brackets. However, HP Search treats a hyphen lit-
erally inside brackets if it is the first or last character inside the brackets.
+ Matches one or more occurrences of the previous character. It also matches one or more
occurrences of the previous pattern if the pattern is in parentheses or brackets.
* Matches zero or more occurrences of the previous character. It also matches zero or more
occurrences of the previous pattern if the pattern is in parentheses or brackets.
? Matches exactly one of any character.
# Matches exactly one of any digit.
@ Matches any number of unspecified characters. (Equivalent to ?*).
\ Causes any subsequent character to be interpreted literally.
If you want to search your files for occurrences of the pattern "BUF", regardless of surrounding characters,
you can simply specify the following on the HP Search command line.
HPSEARCH "filenames FOR BUF"
The pattern "BUF" contains no wildcard or pattern-matching characters. It specifies only the pattern
"BUF". However, using pattern-matching characters, you can create many other search strings. Some
examples are shown below. These examples assume that the USECASE option has been specified to make
the searches case-sensitive.
Syntax Pattern Specified
(a|[c-z]|[1-4]) A single character chosen from the following group: "a", the range "c" to "z", or the range
1 to 4.