FindPattern Function

Syntax

Number FindPattern(String string, String stringPatternToSearchFor, [Number indexToSearchFrom = 0], [Boolean ignoreCase = False], [Out] [Number patternLength])

Return Value

Number

Number containing the start index of the first substring matching the pattern. Returns -1 if the pattern is not found.

Purpose

This function searches for a substring that matches the regular expression pattern.

Parameters

string as String

The string to compare against a pattern.

stringPatternToSearchFor as String

The regular expression pattern to search for.

Note The regular expression pattern follows the standard ECMAScript grammar. Refer to the Microsoft documentation for regular expressions for more information.

indexToSearchFrom as Number

(Optional) A number that specifies the zero-based character index at which to begin searching. The default is 0.

ignoreCase as Boolean

(Optional) A Boolean that specifies whether to ignore character case when searching. The default is False.

patternLength as Number

(Optional) A number representing the length of the substring matching the pattern.