PatternMatch

(Engine-Level Function)

Description: Compares a string against a reference pattern and returns true if the string matches the pattern. Along with literal characters, PatternMatch currently supports the * and ? wildcard characters within the reference pattern (see Pattern parameter).
Returns: Boolean
Usage: Script or Steady State
Function Groups: String and Buffer
Related to:
Format: PatternMatch(String, Pattern [, CaseInsensitive])
Parameters:  
String
Required. The string you wish to compare to Pattern.
Pattern

Required. The reference pattern to which you wish String to be compared.
Wildcards are allowed. The wildcard "?" will match any character in a name. The wildcard "*" will match any series of characters.
The backslash character has special meaning, in that it can be added in front of the characters *, ? or \ to search for these characters explicitly. In these three cases, the leading backslash will be ignored.
Other characters must match exactly. A leading backslash in front of any characters other than the three noted will be included in the search.

CaseInsensitive
An optional Boolean parameter that indicates whether PatternMatch should be case insensitive when it performs the matching. The default for this parameter is FALSE, indicating that PatternMatch should be case sensitive.
Comments: If any of the arguments to PatternMatch are Invalid, PatternMatch returns Invalid.

Examples:

PatternMatch call Result Comments
PatternMatch("Pump_1", "Pump_*") True  
PatternMatch("Pump_123", "Pump_*") True  
PatternMatch("Pump_1", "Pump_?") True  
PatternMatch("Pump_123", "Pump_?") False Only matching if there is a single character after the underscore
PatternMatch("abc", "a?c") True  
PatternMatch("abbc", "a?c") False  
PatternMatch("abbc", "a*c") True  
PatternMatch("a*c", "a\*c") True  
PatternMatch("abc", "a\*c") False Only matches a literal '*' character