I have the following PowerShell:
$img="john.smith.jpg"
$img.Replace(".", "")
I'm trying to replace the first occurrence of a a period in the string.
At the moment it replaces all periods and returns: "johnsmithjpg"
The output I'm looking for is: "johnsmith.jpg".
I also tried the following but it doesn't work:
$img="john.smith.jpg"
[regex]$pattern = "."
$img.replace($img, "", 1)
What do I need to do to get it to only replace the first period?