An easy cheat to see which options are available in an enumeration is to use the tab at the PowerShell or ISE prompt. Start with [System.Text.RegularExpressions.RegexOptions]::
, and then use CTRL SPACE(or TAB) to view the options.
, RegexOptions
, :
[System.Enum]::GetNames([System.Text.RegularExpressions.RegexOptions])
enum PowerShell, ( ):
[System.Text.RegularExpressions.RegexOptions]::IgnoreCase
(1
), , 'IgnoreCase'
.
: [regex]::Match()
. [System.Text.RegularExpressions.RegexOptions]::None
( 0
'None'
).
, , IgnoreCase
, .
-, . -bor
( ):
$myOptions = [System.Text.RegularExpressions.RegexOptions]::IgnoreCase -bor
[System.Text.RegularExpressions.RegexOptions]::SingleLine -bor
[System.Text.RegularExpressions.RegexOptions]::IgnorePatternWhitespace
PowerShell . mklement0 , , PowerShell .
, 'IgnoreCase, SingleLine, IgnorePatternWhitespace'
, RegexOptions
. :
$myOptions = 'IgnoreCase, SingleLine, IgnorePatternWhitespace' -as [System.Text.RegularExpressions.RegexOptions]
$myOptions = [System.Text.RegularExpressions.RegexOptions]'IgnoreCase, SingleLine, IgnorePatternWhitespace'