February 2019
Intermediate to advanced
626 pages
15h 51m
English
+ and * are two of a set of characters known as quantifiers. Quantifiers are discussed in great detail later in this chapter.
The * character can be used to repeat the preceding character zero or more times. Consider the following example:
'aaabc' -match 'a*'# Returns true, matches 'aaa'
However, zero or more means the character in question doesn't have to be present at all:
'bcd' -match 'a*' # Returns true, matches nothing
If a character must be present in a string, the + quantifier is more appropriate:
'aaabc' -match 'a+'# Returns true, matches 'aaa' 'bcd' -match 'a+' # Returns false
Combining * or + with . produces two very simple expressions: .* and .+. These expressions may be used as follows:
'Anything' -match ...
Read now
Unlock full access