Pattern Parameters [ HP Search/XL User's Guide ] MPE/iX 5.0 Documentation
HP Search/XL User's Guide
Pattern Parameters
A pattern is a string of text that HP Search attempts to locate in the
various files you specify. Any parameters listed in the HP Search
command line after FOR but before WITH are treated as patterns. On the
command line, you may specify that multiple patterns be searched by
delimiting each pattern with blank spaces or commas. On the command
line, if you want to specify a space in your pattern, your pattern must
be enclosed in single quotation marks. If you want to specify multiple
patterns at the pattern prompt, you must enter them one pattern per line.
Another way to have HP Search look for multiple patterns is to specify
one file containing many patterns. You can specify such a file in HP
Search just like you would a single pattern: simply type ^filename where
filename is the name of a file containing one pattern per line. If you
want one or more blanks to precede a 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 character.
| Matches either the pattern on one side of the bar or the
other. The bar character has special 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 literally
inside brackets if it is the first or last character
inside the brackets.
Character HP Search Functionality
+ 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.
[A-Z]BUF Any one capital letter followed by "BUF".
[A-Z]\(@\); Any string starting with an uppercase alphabetic
character followed by an open parenthesis, any number of
characters, and a close parenthesis. The entire string
must be terminated with a semicolon.
BUF+ Any string that begins with "BU", followed by one or
more occurrences of "F".
BUF* The character string "BU" followed by zero or more
occurrences of "F".
???_BUF# Any three characters followed by the string "_BUF"
followed by any one digit.
\@\?\\ The string "@?\".
`pic x\(15\)' The character string pic followed by a single blank, the
character x, a left parenthesis, the number 15, then a
right parenthesis. Literally, the string pic x(15).
The single quotes around the pattern are required
because of the embedded blank. They are only needed
when entering the pattern in the INFO string.
Characters with Special Meaning in MPE XL
When specifying patterns on the command line, there are three characters
that you cannot use: exclamation point (!), single quotation mark ('),
and double quotation mark ("). Because these characters have special
meaning in the MPE XL operating system, you must use the sequences shown
in Table 3-2 if you want to include them in a pattern specification.
Table 3-2. Characters with Special MPE XL Meaning
-------------------------------------------------------------------------------------------
| |
| Desired Character Sequence Needed to Specify Character |
| in the HP Search Command Line |
| |
-------------------------------------------------------------------------------------------
| |
| Exclamation Point, ! %x or %X |
| |
| Single Quotation Mark, ' %s or %S |
| |
| Double Quotation Mark, " %d or %D |
| |
-------------------------------------------------------------------------------------------
You should note that you only have to use the above sequences when
specifying these characters on the HP Search command lines; use the
sequence or the character itself in an indirect pattern file or at the
pattern prompt.
Specifying Unprintable Characters in a Pattern
On occasion, you may want to search for a pattern that contains an
unprintable character. For example, you could use HP Search to find a
pattern containing the Escape character, ESC. To match an unprintable
character, type a percent sign (%) followed by the octal ASCII value of
the character you want in your pattern. Valid ranges for a character are
the octal values 1 through 377. For instance, %33 should be used to
specify the escape character. To specify an unprintable character
followed by a digit, type a backslash before the digit. For example, to
specify the pattern "ESC6" type %33\6 in the pattern parameter.
MPE/iX 5.0 Documentation