0

<tag1 attribute="0">匹配以 开头和结尾的字符串的正则表达式是什么</tag>

4

1 回答 1

0

正则表达式:<tag1 attribute=”0“&gt;.*?<\/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!");
    }
  }
}
于 2012-07-18T22:44:34.457 回答