Вот код, который должен сделать трюк:
Regex MyRegex = new Regex(
@"(.+\|)(.+)\|(\d{1,})\|(.+)",
RegexOptions.IgnoreCase
| RegexOptions.CultureInvariant
| RegexOptions.IgnorePatternWhitespace
| RegexOptions.Compiled
);
// This is the replacement string
string MyRegexReplace =
@"$1$2\$3\$4";
//// Replace the matched text in the InputText using the replacement pattern
string result = MyRegex.Replace(@"Apple1231|C:\asfae\drqw\qwer|2342|1.txt",MyRegexReplace);
//
result 'Apple1231|C:\asfae\drqw\qwer\2342\1.txt'
Надеюсь, это поможет,
С наилучшими пожеланиями,
Том.