匹配以<tag1 attribute="0">
开头并以</tag>
结尾的字符串的正则表达式是什么?
答案 0 :(得分:0)
正则表达式:<tag1 attribute=”0“>.*?<\/tag>
using System;
using System.Text.RegularExpressions;
public class Test
{
public static void Main()
{
string input = @"this is <tag1 attribute=""0""> and ends with </tag>, okay?";
Console.WriteLine(input);
Match match = Regex.Match(input, @"<tag1 attribute=""0"">.*?<\/tag>",
RegexOptions.IgnoreCase);
if (match.Success)
{
Console.WriteLine("Match!");
}
}
}