using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"(\|)\R(?!\|[ \t]+\d+[ \t]+\|)";
string substitution = @"$1";
string input = @"| 1020941333 | 569|SP |500000343 | 9|18.05.2011|15:27:00|18.05.2011|
18.05.2011|Y-0444871-ENCR | 1,93 |BRL |8000800000 |
Juros, Comissões e T | | |
| | | |
|CLB082902 | | | |COEL |COEL |
Y-0444871 |
| 1020941586 | 43|SP |500000344 |43|18.05.2011|15:41:43|18.05.2011|
18.05.2011|B-0447039-ENCR | 9,02 |BRL |8000800000 |
Juros, Comissões e T | | |
| | | |
|CLB082902 | | | |COEL |COEL |
B-0447039 |";
RegexOptions options = RegexOptions.Multiline;
Regex regex = new Regex(pattern, options);
string result = regex.Replace(input, substitution);
}
}
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for C#, please visit: https://msdn.microsoft.com/en-us/library/system.text.regularexpressions.regex(v=vs.110).aspx