wcmatch


(wcmatch string pattern)

This function verifies the string against the specified wildcard pattern.

Arguments

string  (string) the string to be verified against the pattern
pattern  (string) the wildcard pattern string

supported wildcard specifications :

* asterisk - matches any character sequence, including an empty one, and it can be used anywhere in the search pattern: at the beginning, middle, or end.

? question mark - matches any single character

# pound - matches any single numeric character

@ at - matches any single alphabetic character

. period -  Matches any single nonalphanumeric character

~ tilde - as first pattern character, it matches any characters except those of the pattern

[...] - matches any of the characters contained inside the brackets

[~...] - matches any single character not contained in the brackets

- hyphen - inside brackets, it specifies a range for a single character

, comma - separates to separate two patterns

` reverse quote - handles the next character literally

Return

returns T it string matches with the pattern, NIL otherwise

Example

(wcmatch "-ACHSE" "-A*")  T
(wcmatch "LAYERNAME" "LAY*NAME")  T
(wcmatch "XYZ" "A*,B*,C*,XYZ")  T
(wcmatch "XYZ" "A*,B*,C*,XY*,YZ")  T

(wcmatch "XYZ" "A*,B*,C*,XY,YZ")   NILl
(wcmatch "XYZ" "A*,B*,C*,X*Y,YZ")  NIL
(wcmatch "XYZ" "A*,B*,C*,X*Y,YZ")  NIL
(wcmatch "XYZ" "A*,B*,C*,XY,YZ?")  NIL

Remarks




©  Bricsys NV. All rights reserved.