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-2024 Systematic Solutions, LLC