We can match a string to a pattern, but that is little use, unless we can tell what sub-string the joker or wildcard characters matched. For the purpose the function @cide{JOKER} is available. The argument of this function is an integer number, n starting from 1 and the result is the sub-string that the last pattern matching operator found to match the n-th joker or wild card character. For example
else
print "did not match"
endif
Const nl="\n"
if "file.txt" like "*.*" then
print "File=",joker(1)," extension=",joker(2),nl
will print
File=file extension=txt
If the pattern did not match the string or the argument of the function JOKER is zero or negative, or is larger than the serial number of the last joker or wild card character the result is undef.
Note that there is no separate function for the wild card character sub-strings and one for the joker characters. The function JOKER serves all of them counting each from left to right. The function JOKER does not count, nor return the spaces, because programs usually are not interested in the number of the spaces that separate the lexical elements matched by the pattern.