This function finds a string pattern find$ within another string within$ starting from the specified position StartPos, and returns an integer corresponding to the ending position of find$ in within$. This function allows the wildcard characters "*" and "?".
int MatchEnd(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 ending position of the string pattern.
If the string pattern has not been found, return -1.
Note 1: When using wildcards ? and *, MatchEnd returns the index for the first non-wildcard character (see second Example, below).
Note 2: MatchEnd 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 = MatchEnd(str1$,str2$,1); position = ; //should return 11
int position = MatchEnd("search inside this string","in?"); position=; //should return 9