Compiles a regular expression into an internal format.
x$ = preMatch(pattern$)
x$:svar
pattern$ : Regular expression
The preMatch function converts pattern into an internal format for faster execution. This allows for more efficient use of regular expressions in loops. The string containing the internal format is used as a pattern in reMatch, reSub, or Split. The internal format is identified by four leading bytes "]"#4#2"]".
OpenW 1
Local a$, p$
p$ = preMatch(" ?ieter")
While _Data
Read a$
If reMatch(a$, p$)
Print a$
End If
Wend
Data "Harold","Dieter","Wolfgang","Erhard","Pieter"
An overview of the regular expression pattern can be found in the topic reMatch.
preMatch("?ieter") causes an error as the function does not seem to like the '?' to be the first character; you can get round this by placing a space (which is then ignored) in front of the leading '?' as in the example above.
{Created by Sjouke Hamstra; Last updated: 21/10/2014 by James Gaite}