October 2017
Intermediate to advanced
440 pages
11h 47m
English
The hyphen is used to define a range of characters. For example, we might want to match any number repeated one or more times (using +):
'1st place' -match '[0-9]+' # $matches[0] is "1" '23rd place' -match '[0-9]+' # $matches[0] is "23"
A range in a character class can be any range of ASCII characters, such as the following examples:
The following returns true as " is character 34 and # is character 35 that is, they are within the range !-9:
PS> '"#' -match '[!-9]+'; $matches[0]True"#
The range notation allows hexadecimal numbers within strings to be identified. A hexadecimal character can be identified by a character class containing 0-9 and a-f:
PS> 'The registry value ...
Read now
Unlock full access