Skip to main content

regexp.match(comparisonString)

Determines whether the target regular expression matches the whole of the passed string

Availability

Device + Agent

Parameters

Name Type Description
comparisonString String A string against which the regular expression is matched

Returns

Bool — true if the target regular expression generates a match, otherwise false

Description

This method returns true if the target regular expression generates a match against the string passed as a parameter, or false if there is no match.

Important Because of shortcomings in Squirrel’s regexp, we strongly recommend that you implement regular expressions in your agent code using regexp2.match() as a drop-in replacement for regexp.match().

Example Code