Input:
$string = "this-is-just-an--example"
Output:
this
is
just
an-example
Tried various things centered around Regex.Split and “-[^-]” or “-([^])”.
Example of things that did not work:
[regex]::Split( $string, "-[^-]" )
[regex]::Split( $string, "-([^-])" )
Of course I can use the String.Split and iterate, and realize that empty string means I ran into escaped character… But it’s ugly code.
P.S. tried searching for duped for a few minutes, didn’t find any.
Use the lookahead and lookbehind assertions, and then do a replace to eliminate the remaining doubled characters: