Match |
Strings | |
Aptilis 1 |
Match(String, Pattern)
Match returns a non zero value if the pattern
matches the string.
The point in using 'match' as opposed to a straightforward
equility test, is that the pattern can contain
wildcards, like '*' tp specify any group of characters and '?' to
specify any one character. That allows you to match strings that are
not necessarily exactly similar.
Return Value:
1 if the pattern matches the string, 0 (zero) otherwise.
Example 1: Word ending in 'e'?
print(match("hello", "*e"), "\n") print(match("bye", "*e"), "\n")Result:
0.0000 1.0000 |
Example 2: Word starting with an 'a'?
print(match("banana", "a*"), "\n") print(match("apple", "a*"), "\n")Result:
0.0000 1.0000 |
Example 3: Word containing a 't'?
print(match("clue", "*t*"), "\n") print(match("ate", "*t*"), "\n")Result:
0.0000 1.0000 |
Example 4: Word containing a 't', then an 'n'?
print(match("plate", "*t*a*"), "\n") print(match("resting", "*t*n*"), "\n")Result:
0.0000 1.0000 |
Example 5: Word ending in 'ree', with only one letter before 'ree'?
print(match("real", "?ree"), "\n") print(match("tree", "?ree"), "\n")Result:
0.0000 1.0000 |
Notes
The patterns used by 'Match' are exactly the same as
the ones used by GetRecordIndexByNearKey.