using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @".*?(\w+).*\n?";
string substitution = @"$1 ";
string input = @"• BTC ⇒ 59982.00 USD (-6.38%)
• ETH ⇒ 4219.78 USD (-7.94%)
• BNB ⇒ 581.00 USD (-8.59%)
• CAKE ⇒ 16.78 USD (-9.35%)
• BAKE ⇒ 1.880000 USD (-11.42%)
• GRT ⇒ 0.921331 USD (-11.18%)
• LINK ⇒ 29.19 USD (-10.42%)
• DOT ⇒ 40.76 USD (-9.92%)
• XRP ⇒ 1.080000 USD (-8.26%)
• ENJ ⇒ 2.850000 USD (-6.82%)
• SOL ⇒ 221.16 USD (-6.81%)
• DOGE ⇒ 0.236049 USD (-8.49%)
• PROM ⇒ 16.94 USD (-7.29%)
• MATIC ⇒ 1.540000 USD (-9.23%)
• VET ⇒ 0.146540 USD (-10.92%)
• ADA ⇒ 1.880000 USD (-7.45%)
• SHIB ⇒ 0.000049 USD (-10.75%)
• XTZ ⇒ 5.220000 USD (-8.97%)
• ONE ⇒ 0.251386 USD (-12.99%)
• ALGO ⇒ 1.690000 USD (-10.67%)";
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