Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Support negative numbers in -split operator #8960
To solve the problem of negative number arguments in the split command I checked that the argument was in fact negative. If the argument is negative then the regex command gets run with the 'RightToLeft' property. This will grab the correct strings from the content and produce the correct output results. Else if the argument number is not negative then the regex is run normally.
Please look optimizations from https://github.com/PowerShell/PowerShell/pull/5270/files