In using the split operator, as:
**********************
PowerShell transcript start
Start time: 20210719105630
Username: gondor\nicholas
RunAs User: gondor\nicholas
Configuration Name:
Machine: gondor (Unix 5.8.0.59)
Host Application: /snap/powershell/160/opt/powershell/pwsh.dll
Process ID: 16273
PSVersion: 7.1.3
PSEdition: Core
GitCommitId: 7.1.3
OS: Linux 5.8.0-59-generic #66-Ubuntu SMP Thu Jun 17 00:46:01 UTC 2021
Platform: Unix
PSCompatibleVersions: 1.0, 2.0, 3.0, 4.0, 5.0, 5.1.10032.0, 6.0.0, 6.1.0, 6.2.0, 7.0.0, 7.1.3
PSRemotingProtocolVersion: 2.3
SerializationVersion: 1.1.0.1
WSManStackVersion: 3.0
**********************
Transcript started, output file is strings.txt
PS /home/nicholas/power_shell> $string = "b1i9r8t7h"
PS /home/nicholas/power_shell> $array = $string -split "\d"
PS /home/nicholas/power_shell> $array
b
i
r
t
h
PS /home/nicholas/power_shell> $array = $string -split "\D"
PS /home/nicholas/power_shell> $array
1
9
8
7
PS /home/nicholas/power_shell> $array = $string.split("\D")
PS /home/nicholas/power_shell> $array
b1i9r8t7h
PS /home/nicholas/power_shell> $array = $string.split("\d")
PS /home/nicholas/power_shell> $array
b1i9r8t7h
PS /home/nicholas/power_shell> Stop-Transcript
**********************
PowerShell transcript end
End time: 20210719105811
**********************
what is the result of using the dot operator above? Does it do anything? Nothing? Seems it should do something or return an error.
How is the function distinguished from the operator?
see also:
https://www.sqlshack.com/powershell-split-a-string-into-an-array/
https://learn.microsoft.com/en-us/dotnet/api/system.string.split?view=net-5.0
https://learn.microsoft.com/en-us/dotnet/api/system.text.regularexpressions.regex.split?view=net-5.0
On a side note, how are the help files for the operator and the function accessed from the REPL console?
.Split(..)string method will split on a delimiter it doesn't work on regular expressions such as\Dor\d. The-splitoperator on the other hand will allow you to split usingregex, similar to[regex]::Split(..).[regex]::Split('b1i9r8t7h','\D')and'b1i9r8t7h' -split '\D'will give you the results you expect.about_split: learn.microsoft.com/en-us/powershell/module/…