PowerShell - How to insert a colon character before the first backslash in a string?

Viewed 7066

In PowerShell I have a string with a value similar to :

> text/text/text\text\text\text

The string is variable length, and may have different numbers of forward and back slashes.

I want to insert a colon (:) character before the first backslash only. So change it from ...

> text/text/text\text\text\text

to ...

> text/text/text:\text\text\text

What's the simplest way to do this?

Thanks

2 Answers
Related