本文整理汇总了C#中System.Text.RegularExpressions.Match.NextMatch方法的典型用法代码示例。如果您正苦于以下问题:C# Match.NextMatch方法的具体用法?C# Match.NextMatch怎么用?C# Match.NextMatch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Text.RegularExpressions.Match
的用法示例。
在下文中一共展示了Match.NextMatch方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Parse
public static List<Node> Parse(ref Match m, string left, string right, string value)
{
List<Node> result;
result = new List<Node>();
while (m.Success)
{
// left, down
if (m.Groups[left].Success)
{
m = m.NextMatch();
Node tmp;
tmp = new Node();
tmp.Branches = Parse(ref m, left, right, value);
result.Add(tmp);
}
else if (m.Groups[right].Success)
{
// right, up
m = m.NextMatch();
return result;
}
else if (m.Groups[value].Success)
{
// value, pluck
Node tmp;
tmp = new Node();
tmp.Leaf = m.Groups[value].Value;
result.Add(tmp);
m = m.NextMatch();
}
}
return result;
}
示例2: BuildSelection
private void BuildSelection(string content, FlowDocument selectionDoc, Match m)
{
var p = new Paragraph();
int lastPosition = 0;
while (m.Success)
{
p.Inlines.Add(new Run(content.Substring(lastPosition, m.Index)));
p.Inlines.Add(new Bold(new Run(content.Substring(m.Index, m.Length))));
lastPosition = m.Index + m.Length;
if (!m.NextMatch().Success)
{
p.Inlines.Add(new Run(content.Substring(lastPosition, content.Length - lastPosition)));
}
selectionDoc.Blocks.Add(p);
m = m.NextMatch();
}
}
示例3: MatchViewModel
protected MatchViewModel(Match model)
{
Model = model;
var groups = model.Groups;
var capture = model.Captures;// Capture has Index, Length, Value
var index = model.Index;
var length = model.Length;
var next = model.NextMatch();
var result = model.Result(stringg);
var x = model.Success;
var y = model.Value;
groups[0].
示例4: ParseDelimiters
private static string[] ParseDelimiters(Match match)
{
var delimiters = new List<string>();
do
{
delimiters.Add(match.Groups["delimiter"].Value);
match = match.NextMatch();
}
while (match.Success);
return delimiters.ToArray();
}
示例5: GetTokenStringList
public static List<string> GetTokenStringList(Match match, string token)
{
if (match.Success)
{
var matchList = new List<string>();
matchList.Add(GetTokenString(match, token).Trim());
do
{
match = match.NextMatch();
matchList.Add(GetTokenString(match, token));
} while (match.Success);
return matchList;
}
return null;
}
示例6: CompactRegexMatches
public CompactRegexMatches(string input, Match match)
{
this.input = input;
this.found = false;
List<CompactRegexMatch> matchList = new List<CompactRegexMatch>();
while (match.Success)
{
this.found = true;
CompactRegexMatch regexMatch = new CompactRegexMatch();
regexMatch.value = match.Value;
bool firstGroup = true;
bool secondGroup = true;
StringBuilder sb = new StringBuilder();
foreach (Group group in match.Groups)
{
if (firstGroup)
{
firstGroup = false;
continue;
}
if (!secondGroup)
sb.Append(' ');
secondGroup = false;
sb.Append('(');
bool firstCapture = true;
foreach (Capture capture in group.Captures)
{
if (!firstCapture)
sb.Append(", ");
sb.AppendFormat("\"{0}\"", capture.Value);
firstCapture = false;
}
sb.Append(')');
}
regexMatch.groups = sb.ToString();
matchList.Add(regexMatch);
match = match.NextMatch();
}
matches = matchList.ToArray();
}
示例7: ReadEntity
private void ReadEntity()
{
matchEnts = regexEnts.Match(content);
while (matchEnts.Success)
{
CBEntity.Items.Add(matchEnts.Groups[1].Value.ToString());
matchEnts = matchEnts.NextMatch();
}
if (CBEntity.Items.Count > 0)
{
CBEntity.SelectedIndex = CBEntity.Items.Count - 1;
CBEntity.IsEnabled = true;
BOk.IsEnabled = true;
}
else
{
MessageBox.Show("Entity не обнаружены.");
CBEntity.IsEnabled = false;
BOk.IsEnabled = false;
}
}
示例8: showNextAppTime
public void showNextAppTime()
{
string county = form1.selecteCounty.Shops[form1.selectedShop]; //big surprise!!! the official entrance is the encoding with s-jis of county's name, BUT, shop's name also works! And now I use shop's name with others' will narely do
string shop = form1.selecteCounty.Sids[form1.selectedShop];
string forTest = Form1.ToUrlEncode(
county,
System.Text.Encoding.GetEncoding("shift-jis")
);
DateTime dateTime = DateTime.MinValue;
string day = "";
string time = "";
string html = Form1.weLoveYue(
form1,
"http://aksale.advs.jp/cp/akachan_sale_pc/search_event_list.cgi?area2="
+ Form1.ToUrlEncode(
county,
System.Text.Encoding.GetEncoding("shift-jis")
)
+ "&event_type=" + sizeType + "&sid=" + shop + "&kmws=",
"GET", "", false, "", ref cookieContainer,
false
);
//available
// <th>予約受付期間</th>
// <td>
// 10/12<font color="#ff0000">(月)</font> 13:30~10/12<font color="#ff0000">(月)</font> 22:00<br />
if (county == form1.selecteCounty.Shops[form1.selectedShop]
&& shop == form1.selecteCounty.Sids[form1.selectedShop]
&& sizeType == form1.selectedType)
{
rgx = @"(?<=<th>予約受付期間</th>\n.*\n\s*)\d+\/\d+(?=\D)";
myMatch = (new Regex(rgx)).Match(html);
while (myMatch.Success)
{
day = myMatch.Groups[0].Value;// no available appointment
rgx = @"(?<=<th>予約受付期間</th>\n.*\n\s*" + day + @"(\s|\S)+?)\d+\:\d+(?=\D)";
Match match2 = (new Regex(rgx)).Match(html);
if (match2.Success)
{
time = match2.Groups[0].Value;
DateTimeFormatInfo dtFormat = new DateTimeFormatInfo();
dtFormat.ShortDatePattern = "yyyy-M-d hh:mm:ss";
dateTime = Convert.ToDateTime("2015-" + Regex.Match(day, @"\d+(?=\/)") + "-" + Regex.Match(day, @"(?<=\/)\d+") + " " + time + ":00");
//how to find the year ?
TimeZoneInfo jst = TimeZoneInfo.FindSystemTimeZoneById("Tokyo Standard Time");
TimeZoneInfo cst = TimeZoneInfo.FindSystemTimeZoneById("China Standard Time");
DateTime nowInTokyoTime = TimeZoneInfo.ConvertTime(DateTime.Now, jst);
if ((dateTime - nowInTokyoTime).TotalMinutes > -15)
{
delegate2 d111 = new delegate2(
delegate() {
form1.label14.Text = "the nearest booking on type " + (sizeType == "6" ? "M" : "L") + " in " + form1.selecteCounty.Name + " " + county
+ " is on: \n" + dateTime.ToString("MM/dd HH:mm") + " Tokyo Standard Time\n"
+ TimeZoneInfo.ConvertTimeFromUtc(TimeZoneInfo.ConvertTimeToUtc(dateTime, jst), cst).ToString("MM/dd HH:mm")
+ " China Standard Time"
;
}
);
form1.label14.Invoke(d111);
return;
}
}
myMatch = myMatch.NextMatch();
}
delegate2 d222 = new delegate2(
delegate() {
if (Regex.Match(html, @"条件に一致する予約販売が存在しません").Success)
{
form1.label14.Text = "There is no type " + (sizeType == "6" ? "M" : "L") + " in " + form1.selecteCounty.Name + " " + county;
}
else
{
form1.label14.Text = "No available booking these days on type " + (sizeType == "6" ? "M" : "L") + " in " + form1.selecteCounty.Name + " " + county;
}
}
);
form1.label14.Invoke(d222);
}//end of if the search option not changed
}
示例9: OnFieldMatch
protected override NextInstruction OnFieldMatch(RecorderContext context, string source, ref Match match)
{
while (match.Success)
{
if (context.SourceHeaderInfo.ContainsKey(match.Groups[1].Value))
context.FieldBuffer[context.SourceHeaderInfo[match.Groups[1].Value]] = match.Groups[2].Value;
match = match.NextMatch();
}
return NextInstruction.Return;
}
示例10: EnumerateMatches
private static IEnumerable<Match> EnumerateMatches(Match match, int count)
{
while (match.Success)
{
yield return match;
count--;
if (count == 0)
yield break;
match = match.NextMatch();
}
}
示例11: EnumerateMatchesRightToLeft
private static IEnumerable<Match> EnumerateMatchesRightToLeft(Match match, int count)
{
var matches = new List<Match>();
while (match.Success)
{
matches.Add(match);
count--;
if (count == 0)
break;
match = match.NextMatch();
}
for (int i = matches.Count - 1; i >= 0; i--)
yield return matches[i];
}
示例12: while
private static List<IIMDbSearchResult> MultipleMatchesAddToSearchResults
(Match match, IMDbRegEx imDbRegex, List<IIMDbSearchResult> results)
{
while (match != null && match.Length > 0)
{
var result = IMDbConventionalFilmSearchEngineHelpers
.MultipleMatchesMineDetailsOfSingleFilmResult(match, imDbRegex);
IMDbConventionalFilmSearchEngineHelpers
.IgnoreIrrelevantResults
(match, imDbRegex, result);
results.Add(result);
Debugger.LogMessageToFile
("[IMDb Conventional Film Search Engine] " +
"Result was added to list.");
match = match.NextMatch();
Debugger.LogMessageToFile
("[IMDb Conventional Film Search Engine]" +
" Proceeding to next result...");
}
return results;
}
示例13: OnFieldMatch
protected override NextInstruction OnFieldMatch(RecorderContext context, string source, ref Match match)
{
if (!match.Success) return NextInstruction.Skip;
var datetime = false;
while (match.Success)
{
if (!datetime) context.FieldBuffer[context.SourceHeaderInfo["Datetime"]] = match.Groups["Datetime"].Value;
datetime = true;
if (context.SourceHeaderInfo.ContainsKey(match.Groups[5].Value))
context.FieldBuffer[context.SourceHeaderInfo[match.Groups[5].Value]] = match.Groups[8].Value;
match = match.NextMatch();
}
return NextInstruction.Return;
}
示例14: FillMatchesArrayAllPatternOrder
/// <summary>
/// Goes through <paramref name="m"/> matches and fill <paramref name="matches"/> array with results
/// according to Pattern Order.
/// </summary>
/// <param name="r"><see cref="Regex"/> that produced the match</param>
/// <param name="m"><see cref="Match"/> to iterate through all matches by NextMatch() call.</param>
/// <param name="matches">Array for storing results.</param>
/// <param name="addOffsets">Whether or not add arrays with offsets instead of strings.</param>
/// <returns>Number of full pattern matches.</returns>
private static int FillMatchesArrayAllPatternOrder(Regex r, Match m, ref PhpArray matches, bool addOffsets)
{
// second index, increases at each match in pattern order
int j = 0;
while (m.Success)
{
// add all groups
for (int i = 0; i < m.Groups.Count; i++)
{
object arr = NewArrayItem(m.Groups[i].Value, m.Groups[i].Index, addOffsets);
AddGroupNameToResult(r, matches, i, (ms, groupName) =>
{
if (j == 0) ms[groupName] = new PhpArray();
((PhpArray)ms[groupName])[j] = arr;
});
if (j == 0) matches[i] = new PhpArray();
((PhpArray)matches[i])[j] = arr;
}
j++;
m = m.NextMatch();
}
return j;
}
示例15: DetailRegexMatches
public DetailRegexMatches(string input, Match match)
{
this.input = input;
this.found = false;
List<DetailRegexMatch> matchList = new List<DetailRegexMatch>();
while (match.Success)
{
this.found = true;
DetailRegexMatch regexMatch = new DetailRegexMatch();
regexMatch.indexMatch = match.Index;
regexMatch.lengthMatch = match.Length;
regexMatch.value = match.Value;
List<DetailRegexGroup> groupList = new List<DetailRegexGroup>();
foreach (Group group in match.Groups)
{
DetailRegexGroup regexGroup = new DetailRegexGroup();
regexGroup.indexMatch = group.Index;
regexGroup.lengthMatch = group.Length;
regexGroup.value = group.Value;
List<DetailRegexCapture> captureList = new List<DetailRegexCapture>();
foreach (Capture capture in group.Captures)
{
DetailRegexCapture regexCapture = new DetailRegexCapture();
regexCapture.indexMatch = capture.Index;
regexCapture.lengthMatch = capture.Length;
regexCapture.value = capture.Value;
captureList.Add(regexCapture);
}
regexGroup.captures = captureList.ToArray();
groupList.Add(regexGroup);
}
regexMatch.groups = groupList.ToArray();
matchList.Add(regexMatch);
match = match.NextMatch();
}
matches = matchList.ToArray();
}