using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"\bbb-([\w\.]+(?::.+)?)=\""([\w\.:]+?)\""\s?";
string input = @"<div class=""theme-black"" style=""padding: 20px;background-color: #fff;"">
<input type=""text"" class=""text"" bb-model=""color:keyup"" bb-change=""handleChange1"" value=""{{color}}"" />
<input type=""text"" class=""text"" bb-model=""color:keyup"" bb-change=""handleChange1"" value=""{{color}}"" />
<input type=""text"" class=""text"" bb-model=""args.color:keyup"" value=""{{args.color}}"" />
<input type=""text"" class=""text"" bb-model=""color1:keyup"" value=""{{color1}}"" />
<input type=""text"" class=""text"" bb-model=""args.color1:keyup"" value=""{{args.color1}}"" />
<textarea bb-model=""color:keyup"">{{color}}</textarea>
<br>
<input type=""button"" value=""值1(#999)"" bb-click=""submit1"">
<input type=""button"" value=""值1(#999)"" bb-click=""submit1"">
<input type=""button"" value=""值2(#ff5241)"" bb-click=""submit2"">
<div class=""result1 "" bb-watch=""color:style:html"" bb-change=""handleChange"" style=""color: {{color}};"">{{color}}</div>
<div class=""result2 "" bb-watch=""args.color:style:html"" style=""color: {{args.color}};"">{{args.color}}</div>
<input type=""button"" value=""dom替换3(#999)"" bb-click=""submit3"">
<input type=""button"" value=""dom替换4(#ff5241)"" bb-click=""submit4"">
<div class=""result3 "" bb-watch=""color1:style:html"" style=""color: {{color1}};"">{{color1}}</div>
<div class=""result4 "" bb-watch=""args.color1:style:html"" style=""color: {{args.color1}};"">{{args.color1}}</div>
<br>
<input type=""button"" value=""模拟组件传入数据(_reset)"" bb-click:enter=""submit5"">
<div class=""all1"" bb-watch=""color:style:html"" style=""color: {{color}};"">{{color}}</div>
<div class=""all2"" bb-watch=""color1:style:html"" style=""color: {{color1}};"">{{color1}}</div>
<div class=""all3"" bb-watch=""args.color:style:html"" style=""color: {{args.color}};"">{{args.color}}</div>
<div class=""all4"" bb-watch=""args.color1:style:html"" style=""color: {{args.color1}};"">{{args.color1}}</div>
<div class=""all5"" bb-watch=""args.color:style,args.color1:html"" style=""color: {{args.color}};"">{{args.color1}}</div>
<input type=""button"" bb-click=""tab1"" value=""切换(00)"" class=""abutton faiButton faiButton-hover"" style=""margin-top:5px;"" />
<input type=""button"" bb-click=""tab2"" value=""切换(01)"" class=""abutton faiButton faiButton-hover"" style=""margin-top:5px;"" />
<div bb-watch=""tab:style"" style=""display: {{#compare tab '===' '00'}}block;{{else}}none;{{/compare}}"">00</div>
<div bb-watch=""tab:style"" style=""display: {{#compare tab '===' '01'}}block;{{else}}none;{{/compare}}"">01</div>
</div>";
RegexOptions options = RegexOptions.IgnoreCase | RegexOptions.Multiline;
foreach (Match m in Regex.Matches(input, pattern, options))
{
Console.WriteLine("'{0}' found at index {1}.", m.Value, m.Index);
}
}
}
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