Skip to main content

lookingAt (Function)

Matches the input.sequence from the beginning against the regex pattern, and unlike regex:matches() it does not require that the entire input.sequence be matched.

Syntax

<BOOL> regex:lookingAt(<STRING> regex, <STRING> input.sequence)

Query Parameters

NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
regexA regular expression. 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

Example 1

regex:lookingAt('\d\d(.*)(gdn.*)', '21 products are produced by gdn currently in Sri Lanka')

Function matches the input.sequence against the regex pattern, \d\d(.*)(gdn.*) from the beginning, and as it matches it returns true.

Example 2

regex:lookingAt('gdn(.*)middleware(.*)', 'sample test string and gdn is situated in trace and it's a middleware company')

Function matches the input.sequence against the regex pattern, gdn(.*)middleware(.*) from the beginning, and as it does not match it returns false.