Skip to content

String method Split - bug with multiple split characters #11720

@zchristoffer

Description

@zchristoffer

Steps to reproduce

PS /home/user> '11111x22222y33333'.Split('xy')
11111x22222y33333

Expected behavior

PS C:\Users\user> '11111x22222y33333'.Split('xy')
11111
22222
33333

Actual behavior

Same issue on both pwsh 6.2.4 and 7.0.0-rc2
It does work well on Powershell 5.1

Workaround

PS /home/user>  '11111x22222y33333' -Split '[xy]'
11111
22222
33333

Environment data

PS /home/user> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      7.0.0-rc.2
PSEdition                      Core
GitCommitId                    7.0.0-rc.2
OS                             Linux 4.15.0-76-generic #86-Ubuntu SMP Fri Jan 17 17:24:28 UTC 2020
Platform                       Unix
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-Questionideally support can be provided via other mechanisms, but sometimes folks do open an issue to get aResolution-AnsweredThe question is answered.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions