Equinox Online Help - Language Reference - A to Z

Home

Match

Applies to
SyntaxMatch(TargetExpression, PatternExpression [, SearchExpression])
Action[Function] Returns True if the arguments match.
ScopeUsable anywhere.
Notes

This function compares TargetExpression and PatternExpression. If they match, then True (a non-zero integer) is returned. The integer is actually the character position of the first matching character in PatternExpression. If they do not match, then False (zero) is returned.

You can include the following special characters in PatternExpression:

  • * Wildcard: matches any number of characters
  • ? Wildcard: matches any single character
  • \n Matches an end of line character
  • \t Matches a tab character
  • \* Matches an asterisk character
  • \? Matches a question mark character
  • \\ Matches a back-slash character

The fifth argument, SearchExpression, can take one of the following values:

  • 0 Exact case and recognises special characters
  • 1 Any case and recognises special characters
  • 2 Exact case and ignores special characters
  • 3 Any case and ignores special characters
  • 4 Sliding search, exact case and recognises special characters
  • 5 Sliding search, any case and recognises special characters
  • 6 Sliding search, exact case and ignores special characters
  • 7 Sliding search, any case and ignores special characters

Exact case dictates the two strings must be the same case to match. Any case ignores the differences. By using the value 2 or 3 you can choose to ignore special characters in the TargetExpression.

Sliding search means, for example, that searching for "asdf" in "this asdf string" returns true (This example uses value 6).

If you omit the argument, then by default the value 0 is used.

CategoryString handling
See Also ChrList, Chrs, Compare, Fill, IsNumber, Left_Function, Len, Maxlen, Mid_Function, Remove, Replace, Right_Function], Search_SearchNext, SetLen, SetMaxLen, SortOrder, SubstituteData
Example

The first example returns True for names like Smith, Smythe, Smithson, but False for smith, Smoothey, etc

Match(lastname, "Sm?th*")

The next example matches "Terminator", "The terminator", "Terminator Two", Exterminator", etc and ignores any special characters in the variable 'txt'.

Match(txt, "*terminator*", 2)