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

Extracting a Substring Based on Regular Expression Matching

A string can be extracted from a larger string using the following syntax:

env.getRegexpMatch(stringToMatch, someRegularExpression, occurrence)

This example gets the third occurrence of a sequence of numbers followed by a space, followed by a sequence of letters within string outputLine:

<# value := env.getRegexpMatch(outputLine, "[0-9]+ [a-zA-Z]+", 3) #>

This example gets the interface value from an interface string:

<# interface := env.getRegexpMatch(interface, "[0-9]+/[0-9]+", 1) #>


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