







Help on Searching
The text that you enter into the "Search For:" text box is actually
a Unix "regular expression," like the argument used in the "grep"
command. If you understand Unix "regular expressions," then that's
all you need to know.
If you aren't versed in Unix regular expressions, then here's some
information that should help.
To search for a particular word or phrase, just enter the text itself.
For example, to search for the phrase "Poqet Computer", just enter
"Poqet Computer" (without the quotes) in the text box.
To search for two words or phrases together on the same line, seperate
the two words with the characters ".*". For example to search lines
that contain the phrase "Poqet Computer" followed by "Fujitsu", enter
"Poqet Computer.*Fujitsu" in the text box.
To search for more than one word at a time, seperate the words with
a "vertical bar" ("|"). For example to search for lines that contain
the word "Poqet" or the word "Fujtisu," enter "Poqet|Fujitsu" in the
text box.
The Gory Details
Here is a more detailed description of unix regular expressions,
as explained in Programming Perl by Larry Wall and Randall
L. Schwartz.
To be specific, the patterns used in the pattern matching are
regular expressions similar to those used by the Unix "egrep"
program. They work like this:
- A regular expression matches a string if any of the alternatives
of the regular expression match. Alternatives are separated by the
| character (usually called a vertical bar), and are always evaluated
left-to-right, stopping on the first complete match.
- An alternative matches if every item in the alternative matches in
the order the items occur.
- An item consists of either an assertion or a quantified atom.
Assertions are:
^ Matches the beginning of the line
$ Matches the end of the line
\b Matches on word boundary (between \w and \W)
\B Matches on non-word boundary
- A quantified atom consists of one of the atoms listed below followed
by a quantifier, which indicates how many times the atom must or
may not occur. If there is no quantifier, the atom must occur
exactly once. Quantifiers are:
{n,m} Must occur at least n times but no more than m times
{n,} Must occur at least n times
{n} Must match exactly n times
* 0 or more times (same as {0,})
+ 1 or more times (same as {1,})
? 0 or 1 times (same as {0,1})
Legal atoms are:
- A regular expression in parentheses matches whatever the regular
expression matches.
- A . matches any character
- A list of characters in square brackets matches on of a class of
characters. A caret at the front of the list negates the class.
Character ranges may be indicated using the a-z notation.
You may also use any of \d, \w, \s, \n,
\r, \t, \f, or \nnn as
listed below. A \b means a backspace in a character class. You
may also use a backslash to protect a hyphen that would otherwise
be interpreted as a range delimiter.
- A backslashed letter matches a special character or character
class:
\n Newline
\r Carriage return
\t Tab
\f Formfeed
\d A digit, same as [0-9]
\D A non-digit
\w A word character (alphanumeric), same as [0-9a-z_A-Z]
\W A non-word character
\s A whitespace character, same as [ \f\n\r\f]
\S A non-whitespace character
- A backslashed single digit number matches whatever the corresponding
parentheses actually matched (except that \0 matches a null
character). This is called a backreference to a substring. A
backslashed multi-digit number such as \10 will be considered a
backreference if the pattern contains at least that many substrings
prior to it, and the number does not start with a 0.
- A backslashed 2 or 3 digit octal number such as \033 matches the
character with the specified value, unless it would be interpreted
as a backreference.
- A backslashed x followed by two hexadecimal digits, such as
\x7f, matches the character having that hexadecimal value.
- A backslashed c followed by a single character, such as
\cD, matches the corresponding control character.
- Any other backslashed character matches that character.
- Any character not mentioned above matches itself.
Filename: PoqetPC/faq/search-help.html
Date Created: 29 Jun 1996, Last Modified: 23 Jun 2003
Created by Bryan Mason
- E-Mail: poqetpc<at>bmason<dot>com