C# 正则表达式匹配C中两个未闭合标记之间的文本#
我有以下代码:C# 正则表达式匹配C中两个未闭合标记之间的文本#,c#,regex,C#,Regex,我有以下代码: <br> For Day October 21, 2013, The following locations have been restricted<br> <br> No increases in nominations sourced from points west of Southeast for delivery to points e
<br>
For Day October 21, 2013, The following locations have been restricted<br>
<br>
No increases in nominations sourced from points west of Southeast for delivery to points east of Southeast, except for Primary Firm No-Notice nominations, will be accepted.<br>
请为我推荐一个合适的正则表达式您确定需要正则表达式吗 试试像这样的东西
string output = sourceHtml.Replace("<br>", Environment.NewLine).Trim();
string output=sourceHtml.Replace(“
”,Environment.NewLine).Trim();
这将删除
标记,并给出预期结果。您确定需要正则表达式吗
试试像这样的东西
string output = sourceHtml.Replace("<br>", Environment.NewLine).Trim();
string output=sourceHtml.Replace(“
”,Environment.NewLine).Trim();
这将删除
标记,并给出预期结果。您确定需要正则表达式吗
试试像这样的东西
string output = sourceHtml.Replace("<br>", Environment.NewLine).Trim();
string output=sourceHtml.Replace(“
”,Environment.NewLine).Trim();
这将删除
标记,并给出预期结果。您确定需要正则表达式吗
试试像这样的东西
string output = sourceHtml.Replace("<br>", Environment.NewLine).Trim();
string output=sourceHtml.Replace(“
”,Environment.NewLine).Trim();
这将删除
标记,并为您提供预期结果。尝试以下操作:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
namespace RegexTester
{
class Program
{
static void Main(string[] args)
{
var text = @"<br>
For Day October 21, 2013, The following locations have been restricted<br>
<br>
No increases in nominations sourced from points west of Southeast for delivery to points east of Southeast, except for Primary Firm No-Notice nominations, will be accepted.<br>";
var pattern = "<br>\\s*";
var result = Regex.Replace(text, pattern, string.Empty);
Console.WriteLine(result);
Console.ReadKey();
}
}
}
使用系统;
使用System.Collections.Generic;
使用System.Linq;
使用系统文本;
使用System.Text.RegularExpressions;
名称空间RegexTester
{
班级计划
{
静态void Main(字符串[]参数)
{
var text=@“
2013年10月21日,以下地点受到限制
除一级公司无通知提名外,不接受从东南以西的points向东南以东的points交付的提名增加。
“;
var pattern=“
\\s*”;
var result=Regex.Replace(text、pattern、string.Empty);
控制台写入线(结果);
Console.ReadKey();
}
}
}
试试这个:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
namespace RegexTester
{
class Program
{
static void Main(string[] args)
{
var text = @"<br>
For Day October 21, 2013, The following locations have been restricted<br>
<br>
No increases in nominations sourced from points west of Southeast for delivery to points east of Southeast, except for Primary Firm No-Notice nominations, will be accepted.<br>";
var pattern = "<br>\\s*";
var result = Regex.Replace(text, pattern, string.Empty);
Console.WriteLine(result);
Console.ReadKey();
}
}
}
使用系统;
使用System.Collections.Generic;
使用System.Linq;
使用系统文本;
使用System.Text.RegularExpressions;
名称空间RegexTester
{
班级计划
{
静态void Main(字符串[]参数)
{
var text=@“
2013年10月21日,以下地点受到限制
除一级公司无通知提名外,不接受从东南以西的points向东南以东的points交付的提名增加。
“;
var pattern=“
\\s*”;
var result=Regex.Replace(text、pattern、string.Empty);
控制台写入线(结果);
Console.ReadKey();
}
}
}
试试这个:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
namespace RegexTester
{
class Program
{
static void Main(string[] args)
{
var text = @"<br>
For Day October 21, 2013, The following locations have been restricted<br>
<br>
No increases in nominations sourced from points west of Southeast for delivery to points east of Southeast, except for Primary Firm No-Notice nominations, will be accepted.<br>";
var pattern = "<br>\\s*";
var result = Regex.Replace(text, pattern, string.Empty);
Console.WriteLine(result);
Console.ReadKey();
}
}
}
使用系统;
使用System.Collections.Generic;
使用System.Linq;
使用系统文本;
使用System.Text.RegularExpressions;
名称空间RegexTester
{
班级计划
{
静态void Main(字符串[]参数)
{
var text=@“
2013年10月21日,以下地点受到限制
除一级公司无通知提名外,不接受从东南以西的points向东南以东的points交付的提名增加。
“;
var pattern=“
\\s*”;
var result=Regex.Replace(text、pattern、string.Empty);
控制台写入线(结果);
Console.ReadKey();
}
}
}
试试这个:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
namespace RegexTester
{
class Program
{
static void Main(string[] args)
{
var text = @"<br>
For Day October 21, 2013, The following locations have been restricted<br>
<br>
No increases in nominations sourced from points west of Southeast for delivery to points east of Southeast, except for Primary Firm No-Notice nominations, will be accepted.<br>";
var pattern = "<br>\\s*";
var result = Regex.Replace(text, pattern, string.Empty);
Console.WriteLine(result);
Console.ReadKey();
}
}
}
使用系统;
使用System.Collections.Generic;
使用System.Linq;
使用系统文本;
使用System.Text.RegularExpressions;
名称空间RegexTester
{
班级计划
{
静态void Main(字符串[]参数)
{
var text=@“
2013年10月21日,以下地点受到限制
除一级公司无通知提名外,不接受从东南以西的points向东南以东的points交付的提名增加。
“;
var pattern=“
\\s*”;
var result=Regex.Replace(text、pattern、string.Empty);
控制台写入线(结果);
Console.ReadKey();
}
}
}
您是否正在尝试从html文件中解析/提取数据?尝试使用Regex可能有点困难,因为标记是相同的-我不知道如何在不获取所有相关信息的情况下做到这一点:您是否正在尝试从html文件中解析/提取数据?尝试使用Regex可能有点困难,因为标记是相同的-我不知道如何在不获取所有相关信息的情况下做到这一点:您是否正在尝试从html文件中解析/提取数据?尝试使用Regex可能有点困难,因为标记是相同的-我不知道如何在不获取所有相关信息的情况下做到这一点:您是否正在尝试从html文件中解析/提取数据?尝试使用Regex可能会有点困难,因为标记是相同的-我不确定如何在不获取所有bligatory和相关信息的情况下实现这一点: