I have a line like the following "Blaa ... blup..blaaa ... blah."
Each part, where there is more than one point, must be replaced by "_", but it must have the same amount as the replaced characters.
The line should lead to: "Blah ___ blup__blaaa ___ blah."
Please note that the last point is not replaced because it has no other connected points.
I tried using the following regex approach in powershell, but I always get legnth from 2 for a match no matter where there are 3 or more points:
$string -replace '(.)\1+',("_"*'$&'.length)
Any ideas?
source
share