The acutWcMatch() function enables applications to compare a string to a wild-card pattern. This facility can be used when building a selection set (in conjunction with acedSSGet()) and when retrieving extended entity data by application name (in conjunction with acdbEntGetX()).
The acutWcMatch() function compares a single string to a pattern, and returns RTNORM if the string matches the pattern, and RTERROR if it does not. The wild-card patterns are similar to the regular expressions used by many system and application programs. In the pattern, alphabetic characters and numerals are treated literally; brackets can be used to specify optional characters or a range of letters or digits; a question mark (?) matches a single character, and an asterisk (*) matches a sequence of characters; certain other special characters have meanings within the pattern. For a complete table of characters used in wild-card strings, see the description of acutWcMatch().
In the following examples, a string variable called matchme has been declared and initialized. The following call checks whether matchme begins with the five characters “allof”.
if (acutWcMatch(matchme, "allof*") == RTNORM) { . . . }
The following call illustrates the use of brackets in the pattern. In this case, acutWcMatch() returns RTNORM if matchme equals “STR1”, “STR2”, “STR3”, or “STR8”.
if (acutWcMatch(matchme, "STR[1-38]") == RTNORM) { . . . }
The pattern string can specify multiple patterns, separated by commas. The following call returns RTNORM if matchme equals “ABC”, if it begins with “XYZ”, or if it ends with “123”.
if (acutWcMatch(matchme, "ABC,XYZ*,*123") == RTNORM) { . . . }
The acutWcMatchEx() function is similar to acutWcMatch(), but it has an additional argument to allow it to ignore case.
bool acutWcMatchEx( const char * string, const char * pattern, bool ignoreCase);