using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"(?<!^)[ \t]*\r?\n(?=\$)";
string substitution = @",";
string input = @"$index 57320
$title The vertex-cover polynomial of a graph
$time 1988
$abstract In this paper we define the vertex-cover...
$index 57321
$title Locating stations on rapid transit lines
$time 1978
$index 57322
$title Fast heuristics for large scale covering-location problems
$time 1998
$abstract We propose fast heuristics for large scale...
$index 57323
$title Efficient vector processing on dataflow supercomputer SIGMA-1
$time 2001
$abstract Efficiency in vector handling is the key to obtaining high... ";
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