5-4. String Searches and Find Mechanisms
One giant leap for mankind.
—Neil Armstrong (1969)
Before going further into LEAP, it is useful to treat the subject of the interface to searches with somewhat more precision. A string is a sequence of characters; ordinary English words and sentences are examples of strings. String searches look through a (usually lengthy) string, called the text, for an instance of a (usually brief) string that the user specifies, called the pattern. Each occurrence of a substring of the text that matches the pattern is called a target. For example, if you were trying to find where you had written of a cat called “little Tatsu” in a long letter, little Tatsu is a good choice of target, and you might choose the briefer ...