February 2019
Intermediate to advanced
626 pages
15h 51m
English
The -split operator splits a string into an array based on a regular expression.
The following example splits the string into an array containing a, b, c, and d by matching each of the numbers:
PS> 'a1b2c3d4' -split '[0-9]' abcd
The results of as split can be assigned to one or more variables. The split operator also supports a maximum number of split operations, and options for the split operation. Options include SimpleMatch which changes -split to use a simple wildcard as shown in the example below.
'a1b2c3d4' -split 'b2', 0, 'SimpleMatch'
The value of 0 in the example above represents an unlimited number of results.
Read now
Unlock full access