in reply to How do I escape a :: in s///?

As you can see the output substitutes the string but then adds the :: and everything after it again.
No, it doesn't. You asked it to replace the sbo part, and only the sbo part, and that's what s/// did. If you want to replace the entire string, do something like:
$_ = "$newstring\n" if /^$group/;
instead.