This function finds a string pattern find$ within another string within$ starting from position StartPos, and returns an integer corresponding to the starting position of find$ in within$. This function allows the wildcard characters "*" and "?".
Users seeking the functionality of MS Excel's Search function (case-insensitivity, wildcard support) can use MatchBegin. See Syntax, below.
int MatchBegin(within$, find$ [, StartPos, Case])
NOTE: Order of string arguments is reverse of MS Excel's Search and Find functions.
within$
find$
StartPos
Case
If the string pattern has been found, return the starting position of the string pattern.
If the string pattern has not been found, return -1.
Note 1: When using wildcards ? and *, MatchBegin returns the index for the first non-wildcard character (see second Example, below).
Note 2: MatchBegin does not support searches for raw characters ? or *. To search a string for ? or *, use the Search function (which does not support wildcards).
string str1$ = "From: test@Originlab.com"; string str2$ = "From*@"; int position = MatchBegin(str1$,str2$,1); position = ; //should return 1
int position = MatchBegin("search inside this string","?in"); position=; //should return 8