[Contents] [Prev] [Next] [Index] [Report an Error]

Adding Regular Expression Matching to Macros

Use the following syntax to check a string against a regular expression:

env.regexpMatch(stringToMatch, someRegularExpression)

For example, the string outputLine is checked to determine whether it starts with the value System:

<# if env.regexpMatch(outputLine, "^System") #>
. . .
<# endif #>

In this example, the string interface is checked to determine whether it has the correct syntax:

<# interface := env.argv(1) #>
<# if env.regexpMatch(interface, "^[0-9]+/[0-9]+$") #>
. . .
<# endif #>

[Contents] [Prev] [Next] [Index] [Report an Error]