in reply to Re: regex replacement help
in thread regex replacement help

    s/(~+)/$1\n/g;

Another variant would be to use the (relatively new) \K ("Keep the stuff left of the \K"), which avoids having to capture/re-insert the matched fragment:

s/~+\K/\n/g;