Description:
Find if a string matches a format string.
Syntax:
like(stringExp, formatExp)
Note:
The function checks if the string stringExp matches the format string formatExp. In the format string, the asterisk "*" matches 0 or multiple characters; and the question mark "?" matches a single character. An escape character is used to make "*" match the character itself, for example, \* is escaped to * and \\ to \.
Parameter:
stringExp |
A string expression |
formatExp |
A format string expression |
Option:
@c |
It makes the matching case-insensitive, while the default is case-sensitive |
@s |
Use SQL wildcard characters; % matches zero or multiple characters and __ matches a single character; this option does not work with @c option |
Return value:
Boolean value
Examples:
like("abc123", "abc*") |
true |
like("abc123", "abc1?3") |
true |
like("abc123", "abc*34") |
false |
like("abc123", "ABC*") |
false |
like@c("abc123", "ABC*") |
true |
like ("abc*123", "abc\*") |
true |
true abc\\** is escaped to abc\** |
|
like@s("abc123", "abc1_3") |
true |
like@s("abc123", "abc%") |
true |