KI_PMATCH

Pattern match filenames

Synopsis:
CALL KI_PMATCH sample$, pattern$ TO result
result = 'ki_pmatch( sample$, pattern$ )
ArgumentEnumerationPurpose
sample$File name
pattern$Pattern containing "?", "*" or "[]"
result1 for a match, 0 for no match
>KI_PMATCH

KI_PMATCH

This routine performs case-sensitive pattern matching on the string passed in sample$ using the expression in pattern$ which can be a mixture of a literal characters or metacharacters. The status is TRUE if they match and FALSE if there is no match. Matching is done with a shell pattern matching algorithm rather than a true Unix regular expression. Supported metacharacters are:

Metacharacter Purpose
[s] Any character in the set s where s is either a list of single chararacters e.g. [abcABC] or a range separated with a - e.g. [a-c] or some combination
[!s] Any character not in the set s.
? matches a single character
* matches zero or more characters

Examples:

pattern$Comment
*Always matches any string
XYZ*TRUE if string begins with XYZ
*XYZTRUE if string ends with XYZ
*XYZ*TRUE if string contains XYZ
[0-9]*TRUE if string begins with a decimal digit
History
Introduced in KCML 3.00
See Also:
IP_TOS, KI_AES_DECRYPT, KI_AES_ENCRYPT, KI_COMP, KI_COMPFILE, KI_CRYPT, KI_DCOMP, KI_DCOMPFILE, KI_DES_DECRYPT, KI_DES_ENCRYPT, KI_DF, KI_DFK, KI_DIR, KI_DIR_LIST, KI_DS, KI_MD5, KI_PID, KI_SHA1, KI_SIZE, KI_STAT, KI_STATFS, KI_TOUCH, R7_DATE2J, R7_J2DATE
KCML database status codes