Skip to main content

find (Function)

Finds the subsequence that matches the given regex pattern.

Syntax

<BOOL> regex:find(<STRING> regex, <STRING> input.sequence)
<BOOL> regex:find(<STRING> regex, <STRING> input.sequence, <INT> starting.index)

Query Parameters

NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
regexA regular expression that is matched to a sequence in order to find the subsequence of the same. For example, \d\d(.*)gdn.STRINGNoYes
input.sequenceThe input sequence to be matched with the regular expression. For example, 21 products are produced by gdn.STRINGNoYes
starting.indexThe starting index of the input sequence from where the input sequence is matched with the given regex pattern.For example, 10.0INTYesYes

Example 1

    regex:find('\d\d(.*)gdn', '21 products are produced by gdn currently')

This method attempts to find the subsequence of the input.sequence that matches the regex pattern, \d\d(.*)gdn. It returns true as a subsequence exists.

Example 2

    regex:find('\d\d(.*)gdn', '21 products are produced by gdn.', 4)

This method attempts to find the subsequence of the input.sequence that matches the regex pattern, \d\d(.*)gdn starting from index 4. It returns false as subsequence does not exists.