string upstr = Regex.Replace(str, @"(w{4}(?=[^$]))", "$1-");
注意引用:using System.Text.RegularExpressions;
比如:74B87337454200D4D33F80C4663DC5E5运用它后就变成:74B8-7337-4542-00D4-D33F-80C4-663D-C5E5