using System;
using System.Text.RegularExpressions;
public class Test
{
public static void Main()
{
string myString = "
| Test di matematica | ";
Regex rx = new Regex(@"(.*?)");
MatchCollection matches = rx.Matches(myString);
if (matches.Count > 0)
{
Match match = matches[0]; // only one match in this case
GroupCollection groupCollection = match.Groups;
Console.WriteLine( groupCollection[1].ToString());
}
}
}