Like operator pattern matching
These are the pattern characters:
- _ : Use the underscore to represent a single character.
- %: Use the percent sign to represent zero or more characters.
- !: Use the exclamation point to indicate the following character should not be present.
- […]: Use square brackets to indicate groups/ranges.
This table provides examples:
Left hand side | Right hand side | Result |
---|---|---|
This is an example for like rule | %example% | True |
This is an example for like rule | %This% | True |
This is an example for like rule | example% | False |
digital | %gi?a% | True, a question mark (?) can also match any character. |
London | _ondon | True |
Berlin | [bsp]% | True, begins with b, s, or p followed by zero or more characters. |
Berlin | [a-c]% | True, begins with any character in the range a through c followed by zero or more characters. |
Berlin | [!bsp]% | False, does not begin with b, s, or p followed by zero or more characters. |
Madrid | [!bsp]% | True, does not begin with b, s, or p followed by zero or more characters. |
Antonio Moreno | a%o | True, begins with a and ends with o. |
Antonio Moreno Taqueria | a%o | False |