484
MSK( ) Function
Scan String for Mask
Format
MSK(string$,mask$[,ERR=stmtref])
Where:
mask$
String containing the pattern / mask definition. If this value is null,
then the previously used pattern is reused. String expression.
stmtref
Program line number or label to transfer control to.
string$
String to search. Maximum string size 8kb.
Returns
Integer reporting starting offset.
Description
Use the MSK( ) function to scan a string looking for a specific pattern of characters.
The value returned is an integer reporting the starting offset of the longest string
matching the given mask or pattern. The pattern defines the mask as a regular
expression or series of characters, some of which have a special meaning. The
following table lists those characters and their meanings. Combinations are allowed.
Mask Character.
Format in Pattern$
Search
At start of regular
To find a match with the start of the
^ Caret
expression.
string being searched.
At end of regular
To find a match with the end of the
$ Dollar Sign$
expression.
string being searched.
Period
.
To find a match with any character
String of characters
To define a sub-expression to match.
(or other codes)
( string )
enclosed in
parentheses.
String enclosed in
To find a match with any character in
[ string ]
square brackets
that string.
Square bracketing
To find a match with any character
combined with a
except the characters in the string; e.g.,
[^string]
caret ^ as the first
[xyz] matches x, y, or z, while
character of the
[^xyz] matches a, b, c, but not
string.
x, y, or z.
To specify a range.
2 characters
Dash
separated by dash.
Combination of dash
To form expressions: e.g., [a-bd-z] to
[string]
within string in
search for a match with any lower case
square brackets.
letter except c.