The code |M is useful for finding text where the beginning and end are defined, but the middle does not matter. More info on Pattern Matching Codes For example, let’s say you want to check that all quote marks are properly paired. Select SEARCH > Search and enter the following search string: "|M" (That is four characters)
The search will move the cursor to the beginning of the first quotation and highlight the entire quoted string. Each time you press SEARCH > Next ,the cursor will move to the next quotation. If it does not, a quote mark is not properly paired.
Besides being useful in searches, the |M code can be used to delete large blocks of text. For example, the following search and replace string would delete this paragraph:
Search: Besides|Mparagraph: Replace: (None, just press Enter)
The |M code often matches too much text. For example, the incorrect search string “|Sa|Mtion|S” would match words beginning in “a” and ending in “tion”. However, it will also match the next word beginning in “a” followed by any amount of text until it finds a word ending in “tion”.
The code |* also matches multiple characters, but they must all occur on the same line (or record). Therefore, the correct search string for finding all words beginning in “a” and ending in “tion” would be:
|Sa|*tion|S
(Our examples show pattern matching codes in upper case for clarity, but they can be entered in lowercase.)
In other words, the characters matched by |* will not include the “newline” characters (or characters that cross a record boundary).
The code |Y also matches multiple characters, but is more restrictive than |M. |M matches ever more characters until the rest of the search string is satisfied, or the end of the file is reached. Once that portion of the search string in front of the |M is matched, it is never searched for again; there is no need.
On the other hand, |Y matches ever more characters only until the very next character (or pattern) matches. If the rest of the search string then fails, the entire search string is re-searched.
For example, in assembly language programming, any text following a “;” character is a comment. Instructions are often followed by a few tabs (to align the comments), the “;” and the comment. The following search and replacement strings will delete the tabs (and/or spaces) and the comment which follow any instruction. However, lines which are entirely comments (i.e. that have a “;” in the first column) are not deleted.
Search: |W;|Y|> Replace: (None, just press <Enter>)
As another example, we want to search for the following two lines:
MOV BL,DL ;An arbitrary coment MOV BH,DH
We want to be certain that the second line immediately follows the first line. As indicated, the critical part of the first line could be followed by unknown text. The search string to find these two lines is:
mov bl,dl|Y|Lmov bh,dh
Notice that substituting |M for |Y would not perform the same function — we could no longer be sure that the second line immediately followed the first line. (The example shows |Y and |L in upper case for clarity, but pattern matching codes can be entered in lowercase.)