-split operator doesn't let you use options SingleLine and MultiLine at the same time (and it should) #4712
Labels
Issue-Enhancement
the issue is more of a feature request than a bug
Resolution-Fixed
The issue is fixed.
WG-Language
parser, language semantics
Steps to reproduce
But it is not an invalid combination, they do different things, and it is common and useful to use them together.
The PowerShell spec v 3.0, section 7.8.4.5 "Binary split operator" says:
Singleline is not the default of Multiline, they are not two sides of the same option. Multiline changes how the regex characters
^
and$
work with newlines in a string, and Singleline changes how the regex character.
works with newlines in a string. It is valid to use both options to change both^$
and.
at the same time.e.g.
The documentation in
Get-Help about_split
is also incorrect:Link to source code of parserutils.cs where the error is thrown
Link to source code of parserutils.cs where the comment in the SplitOptionsEnum has the same inaccurate suggestion that one is the default setting of the other
Expected behavior
Specifying an options string
'singleline,multiline'
is valid, and enables both Singleline and Multiline mode.The documentation is accurate.
Actual behavior
It throws an exception and misleadingly says they are invalid together.
The documentation is inaccurate in three senses - implying there is one option being set instead of two, implying Singleline is the opposite of Multiline, and stating Singleline "is the default" when Singleline itself is off by default.
Environment data
The text was updated successfully, but these errors were encountered: