using System;
namespace System.Text.RegularExpressions
{
/// Represents the results from a single regular expression match.
// Token: 0x020002AF RID: 687
[Serializable]
public class Match : Group
{
// Token: 0x0600190F RID: 6415 RVA: 0x00055C30 File Offset: 0x00053E30
private Match()
{
this.regex = null;
this.machine = null;
this.text_length = 0;
this.groups = new GroupCollection(1, 1);
this.groups.SetValue(this, 0);
}
// Token: 0x06001910 RID: 6416 RVA: 0x00055C68 File Offset: 0x00053E68
internal Match(Regex regex, IMachine machine, string text, int text_length, int n_groups, int index, int length)
: base(text, index, length)
{
this.regex = regex;
this.machine = machine;
this.text_length = text_length;
}
// Token: 0x06001911 RID: 6417 RVA: 0x00055C8C File Offset: 0x00053E8C
internal Match(Regex regex, IMachine machine, string text, int text_length, int n_groups, int index, int length, int n_caps)
: base(text, index, length, n_caps)
{
this.regex = regex;
this.machine = machine;
this.text_length = text_length;
this.groups = new GroupCollection(n_groups, regex.Gap);
this.groups.SetValue(this, 0);
}
/// Gets the empty group. All failed matches return this empty match.
/// An empty .
// Token: 0x170007DE RID: 2014
// (get) Token: 0x06001913 RID: 6419 RVA: 0x00055CE8 File Offset: 0x00053EE8
public static Match Empty
{
get
{
return Match.empty;
}
}
/// Returns a instance equivalent to the one supplied that is suitable to share between multiple threads.
/// A match that is suitable to share between multiple threads.
/// A match equivalent to the one expected.
///
/// is null.
// Token: 0x06001914 RID: 6420 RVA: 0x00055CF0 File Offset: 0x00053EF0
[global::System.MonoTODO("not thread-safe")]
public static Match Synchronized(Match inner)
{
if (inner == null)
{
throw new ArgumentNullException("inner");
}
return inner;
}
/// Gets a collection of groups matched by the regular expression.
/// The character groups matched by the pattern.
// Token: 0x170007DF RID: 2015
// (get) Token: 0x06001915 RID: 6421 RVA: 0x00055D04 File Offset: 0x00053F04
public virtual GroupCollection Groups
{
get
{
return this.groups;
}
}
/// Returns a new object with the results for the next match, starting at the position at which the last match ended (at the character after the last matched character).
/// The next regular expression match.
///
///
///
// Token: 0x06001916 RID: 6422 RVA: 0x00055D0C File Offset: 0x00053F0C
public Match NextMatch()
{
if (this == Match.Empty)
{
return Match.Empty;
}
int num = ((!this.regex.RightToLeft) ? (base.Index + base.Length) : base.Index);
if (base.Length == 0)
{
num += ((!this.regex.RightToLeft) ? 1 : (-1));
}
return this.machine.Scan(this.regex, base.Text, num, this.text_length);
}
/// Returns the expansion of the specified replacement pattern.
/// The expanded version of the parameter.
/// The replacement pattern to use.
///
/// is null.
/// Expansion is not allowed for this pattern.
// Token: 0x06001917 RID: 6423 RVA: 0x00055D98 File Offset: 0x00053F98
public virtual string Result(string replacement)
{
if (replacement == null)
{
throw new ArgumentNullException("replacement");
}
if (this.machine == null)
{
throw new NotSupportedException("Result cannot be called on failed Match.");
}
return this.machine.Result(replacement, this);
}
// Token: 0x170007E0 RID: 2016
// (get) Token: 0x06001918 RID: 6424 RVA: 0x00055DDC File Offset: 0x00053FDC
internal Regex Regex
{
get
{
return this.regex;
}
}
// Token: 0x040013CB RID: 5067
private Regex regex;
// Token: 0x040013CC RID: 5068
private IMachine machine;
// Token: 0x040013CD RID: 5069
private int text_length;
// Token: 0x040013CE RID: 5070
private GroupCollection groups;
// Token: 0x040013CF RID: 5071
private static Match empty = new Match();
}
}