Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.


Excerpt
hiddentrue

matches(value, regExp) Tests whether a value matches a regular expression.


Function: matches()

Tests whether a value matches a regular expression or a list of regular expressions. If a list of regular expressions is supplied, the index in that list for the first matching regular expression is returned; if no matches are found, the function returns 0.

Syntax

matches(value, regExp)

ArgumentTypeDescription
valueString or IntegerValue
regExpRegular ExpressionA regular expression, or a list of regular expressions.

Examples

 matches(in.code, "^[AB].*") 

matches() returns 1 if in.code starts with either 'A' or 'B', and 0 otherwise.


matches(in.line, "^([^,]*[,]){67}[^,]*$") 

Matches a string containing 68 values separated by commas - useful, for example, when filtering for valid lines from an input csv file.


getElement(["Passed","Pending","Failed"],matches(in.code, ["^[AB].*", "^[CD].*", "^[EF].*"]),"Holding")

Translates in.code, which contains a text code for the status of a product, to a useful description.

...