|Electronics & DIY
|About the instructions
|About mailing list
|Mailing list archive
To understand the search process it is important to remember that a file in memory is stored as a long string of Bytes, each Byte representing a character.
The search expression consists of a number of separate search elements strung together, with spaces as desired, to make the expression readable. Spaces outside of a search element are generally ignored (see exception 1 below). The diagram shows six search elements, e1 to e6.
During a search, StrongED maintains three pointers. Pointer Ts (Text Start) points to the Start of the Text string currently being inspected for a match, and is tied to the first element in the Search expression. Tm (Text Match) points to the byte currently being inspected for a Match against the Search expression.
Em (Element Match) points to the search element currently doing the inspecting.
At the start of a search, Tm points to the same place as Ts. Em points to e1. If no match is found, all three are moved on together, one byte at a time, in the text and so on until the text byte being searched matches e1. Now e2 is matched against the next byte(s) of the text - in this case starting at the letter e. If these bytes match, Tm moves on to the end of the matched section and Em moves to e3.
Thus the matching continues in chunks until one if two things happens:
There is also an element ~ which causes search to look ahead without moving the Text Match (Tm) pointer - as shown by Ta (Text ahead) - until the element qualified by the ~ fails to match it (in other words, the ~ qualifier causes any bytes that match the qualified element to be ignored).
The text byte that caused the failure (i.e. is not ignored) is then matched against the following element.
Was this page helpful? Please email me and/or rate this page:
Top of page