Share

acutWcMatch

C++

int acutWcMatch(
    const ACHAR * string, 
    const ACHAR * pattern
);

File

acutads.h

Description

Attempts to match a wild-card pattern to a string.

The acutWcMatch() function returns RTNORM if the string matches the pattern, and RTERROR if it does not.

Alphanumeric characters in the pattern are treated literally. If characters are enclosed in brackets, acutWcMatch() matches a single character (for example, [fo] matches the letter foro). Within brackets, you can use a hyphen (-) to specify a range of letters or digits (for example, [A-D] matches A, B, C, or D). A leading tilde (~) negates the characters; that is, acutWcMatch() reports a match if the string does not correspond. The pattern string can include multiple patterns, separated by commas. Other special characters also have particular meanings; see the table that follows.

If a tilde is not the first character within brackets, it is treated literally. To specify a literal hyphen as an option within brackets, make it the first or last bracketed character (for example, [-ABC] or [ABC-]), or the first character to follow a leading tilde (as in, [~-ABC]). To specify a literal right bracket (]) within brackets, make it the first bracketed character or the first to follow a leading tilde (as in []ABC] or [~]ABC]).

Note Other special characters may be defined in future releases, so use a leading reverse quote (') to escape all special characters that aren't used as described in this section.

Character Definition
# (Pound) Matches any single numeric digit.
@ (At) Matches any single alphabetic character.
. (Period) Matches any single non-alphanumeric character.
* (Asterisk) Matches any character sequence, including an empty one. You can use an asterisk anywhere in the search pattern--at the beginning, middle, or end.
? (Question mark) Matches any single character.
~ (Tilde) If it is the first character in the pattern, then it matches anything except the pattern.
[...] Matches any one of the characters enclosed.
[~...] Matches any single character not enclosed.
- (Hyphen) Uses inside brackets to specify a range for a single character.
, (Comma) Separates two patterns.
' (Reverse quote) Escapes special characters (reads next character literally).

Parameters

Parameters Description
string String to scan
pattern Pattern to scan for

Was this information helpful?