To split on the first occurrence using regex in PowerShell, you can use the -split operator along with a regular expression pattern that matches the delimiter you want to split on. For example, if you want to split a string on the first comma, you can use the following command:
$string = "apple,banana,cherry"
$parts = $string -split ",\s*", 2
In this command, ",\s*" is the regular expression pattern that matches a comma followed by zero or more whitespace characters.