STRMATCH
Syntax | Return Value | Arguments | Keywords | Examples | Version History | See Also
The STRMATCH function compares its search string, which can contain wildcard characters, against the input string expression. The result is an array with the same structure as the input string expression. Those elements that match the corresponding input string are set to True (1), and those that do not match are set to False (0).
The wildcards understood by STRMATCH are similar to those used by the standard UNIX shell:
Syntax
Result = STRMATCH( String, SearchString [, /FOLD_CASE] )
Return Value
Returns 1 if the pattern specified by SearchString exists in String, or 0 otherwise. If the String argument contains an array of strings, the result is an array of 1s and 0s with the same number of elements as String, indicating which elements contain SearchString.
Arguments
String
A scalar string or string array to be searched.
SearchString
A scalar string containing the pattern to search for in String. The pattern string can contain wildcard characters as discussed above.
Keywords
FOLD_CASE
The comparison is usually case sensitive. Setting the FOLD_CASE keyword causes a case insensitive match to be done instead.
Examples
Example 1
Find all 4-letter words in a string array that begin with "f" or "F" and end with "t" or "T":
This results in:
Example 2
Find words of any length that begin with "f" and end with "t":
This results in:
Example 3
Find 4-letter words beginning with "f" and ending with "t", with any combination of "o" and "e" in between:
This results in:
Example 4
Find all words beginning with "f" and ending with "t" whose second character is not the letter "o":
This results in:
Version History
See Also
STRCMP, STRJOIN, STREGEX, STRMID, STRPOS, STRSPLIT
Non-Printing Characters (Application Programming)