Category

String Functions

Description

Determine whether a string matches a pattern

Syntax

Match(string, pattern)

Parameters

string - a literal string enclosed in either double or single quotes ("string" or 'string') or a string function

pattern - a string (or function) defining the pattern to check the string against

Notes

The string and pattern are compared character by character.

? in the pattern can match any single character in the string.

* in the pattern can match zero or more characters in the string.

Otherwise, the characters must match exactly (ignoring case for letters).

Examples

Match("test1", "test2") is False

Match("test1", "test?") is True

Match("test1", "*test") is False

Match("test1", "test*") is True

Common Uses

Does string contain "XYZ"?

Match(string, "*XYZ*")

Does a string start with "XYZ"?

Match(string, "XYZ*")

Does string end with "XYZ"?

Match(string, "*XYZ")

Symbol Information (Norgate)

Was a stock delisted in 1995?

Match(?Symbol, "*-1995??")

Is the current symbol an individual ES futures contract?

Match(?Symbol, "ES-*")

Does the industry of the current stock have anything to do with oil?

Match(?Industry, "*oil*")

 

 

 

 

 

Copyright © 2020-2022 Systematic Solutions, LLC