Prototype: expandrange(string_template, stepsize)

Return type: slist

Description: Generates a list based on an ordered list of numbers selected from a range of integers, in steps specified by the second argument.

The function is the inverse of functions like iprange() which match patterns of numerical ranges that cannot be represented as regular expressions. The list of strings is composed from the text as quoted in the first argument, and a numerical range in square brackets is replaced by successive numbers from the range.


  • string_template: string - String containing numerical range e.g. string[13-47] - in the range: .*
  • stepsize: int - Step size of numerical increments - in the range: 0,99999999999

 "int_group1" slist => {
                       expandrange("swp[13-15]", 1)



     tagged_vlans => { "100", "145" },
    untagged_vlan => "1",
       link_state => up;

History: Introduced in CFEngine 3.7