MMO'SCH:  Search

Bit value:  512

Search the current memo pad for a pattern contained in the TEXT parameter. If the pattern is found, POS is returned <> 0. The pattern in TEXT must start with 10 special control characters which define the actual symbols to be used for certain logical operators and wildcards. (The character shown in the second column below is the suggested character, but there are no defaults.)

Byte#

Char

Description

1

?

Matches exactly one character

2

*

Matches any string (including null).

3

|

Pattern delimiter; used at either or both ends of the pattern to prevent matches within a sub string. E.g., `an' will match `band', whereas `|an|' will only match `an' surrounded by spaces, end or beginning of memo, or punctuation.

4

&

Logical AND; used to search for memos containing more than one pattern.

5

!

Logical OR; used to search for memos containing one of a choice of patterns.

6

@

Matches any one alphabetic character.

7

#

Matches any one numeric character.

8

 

Reserved for later use

9

 

Specifies record terminator in MMO'TBL mode. If blank, INMEMO will return everything from the pattern match to the end of line, otherwise it will return up to the first occurrence of the terminator character (following the pattern match). Line-ends are marked by a single byte with ASCII value 13 decimal.

10

 

Either '^' which specifies SEARCHFOLD or blank, which indicates no upper/lower case conversion.

 

The remainder of the string in TEXT (starting in byte 11) specifies the logical combination of pattern(s) to be matched. Note that all spaces are significant, including leading and trailing spaces and those surrounding logical operators. Note, however, that leading spaces will also match the start of a memo, and a single space anywhere will match any number of contiguous spaces in a memo. The pattern string MUST contain an explicit trailing null. A null pattern is a guaranteed match.

Using the characters suggested above, a sample pattern to look for "DOG" or "CAT" might be:

TEXT = "?#|&!@# ^DOG!CAT"

For examples of using the search facility, see the source code of the DMPMMO utility program and/or the TSTMMO sample program.