LIST:TRANSFORM¶
- $<LIST:TRANSFORM,list,ACTION[,SELECTOR]>¶
This generator expression belongs to the List Transformations family. See that section for related generator expressions.
Syntax¶
$<LIST:TRANSFORM,list,ACTION[,SELECTOR]>
Added in version 3.27.
The list transformed by applying an ACTION to all or, by specifying a
SELECTOR, to the selected list items.
Note
The TRANSFORM sub-command does not change the number of items in the
list. If a SELECTOR is specified, only some items will be changed,
the other ones will remain the same as before the transformation.
ACTION specifies the action to apply to the items of the list. The actions
have exactly the same semantics as for the list(TRANSFORM) command.
ACTION must be one of the following:
APPEND,PREPENDAppend, prepend specified value to each item of the list.
$<LIST:TRANSFORM,list,(APPEND|PREPEND),value[,SELECTOR]>TOLOWER,TOUPPERConvert each item of the list to lower, upper characters.
$<LIST:TRANSFORM,list,(TOLOWER|TOUPPER)[,SELECTOR]>STRIPRemove leading and trailing spaces from each item of the list.
$<LIST:TRANSFORM,list,STRIP[,SELECTOR]>REPLACE:Match the regular expression as many times as possible and substitute the replacement expression for the match for each item of the list.
$<LIST:TRANSFORM,list,REPLACE,regular_expression,replace_expression[,SELECTOR]>Changed in version 4.1: The
^anchor now matches only at the beginning of the input element instead of the beginning of each repeated search. See policyCMP0186.APPLYTransform each selected element by evaluating an arbitrary generator expression
<body>once per element. Within<body>, the bound operand$<_0>expands to the current element. Unlike the configure-timelist(TRANSFORM APPLY)command, the genex form returns the body's value directly and has no side effects. A list-valued body result expands into multiple elements, like any other list-valued generator expression.$<LIST:TRANSFORM,list,APPLY,body[,SELECTOR]>Added in version 4.5.
SELECTOR determines which items of the list will be transformed. Only one
type of selector can be specified at a time. When given, SELECTOR must be
one of the following:
ATSpecify a list of indexes.
$<LIST:TRANSFORM,list,ACTION,AT,index[,index...]>FORSpecify a range with, optionally, an increment used to iterate over the range.
$<LIST:TRANSFORM,list,ACTION,FOR,start,stop[,step]>REGEXSpecify a regular expression. Only items matching the regular expression will be transformed.
$<LIST:TRANSFORM,list,ACTION,REGEX,regular_expression>PREDICATESpecify a generator expression
bodyevaluated once per item with the bound operand$<_0>expanding to the current item. Only items whose body evaluates to1are transformed; the body must evaluate to exactly0or1.PREDICATEmay be combined with any action, includingAPPLY(in which case both bodies bind$<_0>independently). Like all selectors, only one selector may be given;PREDICATEcannot be combined withAT,FOR, orREGEX.$<LIST:TRANSFORM,list,ACTION,PREDICATE,body>Added in version 4.5.