STR_MATCH

Returns 1 (true) if a specified string is found within another string; otherwise, returns 0 (false).

Format

STR_MATCH (Pattern String, Input String)

Arguments

 
Pattern String
Text string. The argument uses wildcards to define the pattern to match.
STR_MATCH uses four wildcard matching sequences:
This wildcard:
Matches:
*
an arbitrary sequence of characters
?
one character
[char]
any of the characters within the brackets
{string1,string2}
any of the characters strings within the braces
Longer strings should appear before shorter ones when occurring in the sequence: abc, ab, a.
Input String
Text string.

Examples

The following functions return 1 or 0, depending on whether a match occurred or not:
 
Function
STR_MATCH("f?d","fad")
Result
1
 
Function
STR_MATCH("f[xyz]d","fxd")
Result
1
 
Function
STR_MATCH("f{ab,bc,cd}d","fbcx")
Result
0
 
Function
STR_MATCH("1?{800,888}?[2ABC][3DEF]*, "1-800-2357205)
Result
1