1083 lines
65 KiB
C#
1083 lines
65 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System.Reflection;
|
|
using System.Reflection.Emit;
|
|
using System.Runtime.Serialization;
|
|
using System.Text.RegularExpressions.Syntax;
|
|
|
|
namespace System.Text.RegularExpressions
|
|
{
|
|
/// <summary>Represents an immutable regular expression.</summary>
|
|
// Token: 0x020002B2 RID: 690
|
|
[Serializable]
|
|
public class Regex : ISerializable
|
|
{
|
|
/// <summary>Initializes a new instance of the <see cref="T:System.Text.RegularExpressions.Regex" /> class.</summary>
|
|
// Token: 0x06001927 RID: 6439 RVA: 0x000560CC File Offset: 0x000542CC
|
|
protected Regex()
|
|
{
|
|
}
|
|
|
|
/// <summary>Initializes and compiles a new instance of the <see cref="T:System.Text.RegularExpressions.Regex" /> class for the specified regular expression.</summary>
|
|
/// <param name="pattern">The regular expression pattern to match. </param>
|
|
/// <exception cref="T:System.ArgumentException">A regular expression parsing error has occurred.</exception>
|
|
/// <exception cref="T:System.ArgumentNullException">
|
|
/// <paramref name="pattern" /> is null.</exception>
|
|
// Token: 0x06001928 RID: 6440 RVA: 0x000560D4 File Offset: 0x000542D4
|
|
public Regex(string pattern)
|
|
: this(pattern, RegexOptions.None)
|
|
{
|
|
}
|
|
|
|
/// <summary>Initializes and compiles a new instance of the <see cref="T:System.Text.RegularExpressions.Regex" /> class for the specified regular expression, with options that modify the pattern.</summary>
|
|
/// <param name="pattern">The regular expression pattern to match. </param>
|
|
/// <param name="options">A bitwise OR combination of the enumeration values. </param>
|
|
/// <exception cref="T:System.ArgumentException">A regular expression parsing error has occurred. </exception>
|
|
/// <exception cref="T:System.ArgumentNullException">
|
|
/// <paramref name="pattern" /> is null.</exception>
|
|
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
|
/// <paramref name="options" /> contains an invalid flag.</exception>
|
|
// Token: 0x06001929 RID: 6441 RVA: 0x000560E0 File Offset: 0x000542E0
|
|
public Regex(string pattern, RegexOptions options)
|
|
{
|
|
if (pattern == null)
|
|
{
|
|
throw new ArgumentNullException("pattern");
|
|
}
|
|
Regex.validate_options(options);
|
|
this.pattern = pattern;
|
|
this.roptions = options;
|
|
this.Init();
|
|
}
|
|
|
|
/// <summary>Initializes a new instance of the <see cref="T:System.Text.RegularExpressions.Regex" /> class using serialized data.</summary>
|
|
/// <param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo" /> object that contains a serialized pattern and <see cref="T:System.Text.RegularExpressions.RegexOptions" /> information.</param>
|
|
/// <param name="context">The destination for this serialization. (This parameter is not used; specify null.)</param>
|
|
/// <exception cref="T:System.ArgumentException">A regular expression parsing error has occurred. </exception>
|
|
/// <exception cref="T:System.ArgumentNullException">The pattern that <paramref name="info" /> contains is null.</exception>
|
|
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
|
/// <paramref name="info" /> contains an invalid <see cref="T:System.Text.RegularExpressions.RegexOptions" /> flag.</exception>
|
|
// Token: 0x0600192A RID: 6442 RVA: 0x00056114 File Offset: 0x00054314
|
|
protected Regex(SerializationInfo info, StreamingContext context)
|
|
: this(info.GetString("pattern"), (RegexOptions)((int)info.GetValue("options", typeof(RegexOptions))))
|
|
{
|
|
}
|
|
|
|
/// <summary>Populates a <see cref="T:System.Runtime.Serialization.SerializationInfo" /> object with the data necessary to deserialize the current <see cref="T:System.Text.RegularExpressions.Regex" /> object.</summary>
|
|
/// <param name="si">The <see cref="T:System.Runtime.Serialization.SerializationInfo" /> object to populate with serialization information.</param>
|
|
/// <param name="context">The place to store and retrieve serialized data. Reserved for future use.</param>
|
|
// Token: 0x0600192C RID: 6444 RVA: 0x0005615C File Offset: 0x0005435C
|
|
void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context)
|
|
{
|
|
info.AddValue("pattern", this.ToString(), typeof(string));
|
|
info.AddValue("options", this.Options, typeof(RegexOptions));
|
|
}
|
|
|
|
/// <summary>Compiles one or more specified <see cref="T:System.Text.RegularExpressions.Regex" /> objects to a named file.</summary>
|
|
/// <param name="regexinfos">An array that describes the regular expressions to compile. </param>
|
|
/// <param name="assemblyname">The file name of the assembly. </param>
|
|
/// <exception cref="T:System.ArgumentException">The value of the <paramref name="assemblyname" /> parameter's <see cref="P:System.Reflection.AssemblyName.Name" /> property is an empty or null string.-or-The regular expression pattern of one or more objects in <paramref name="regexinfos" /> contains invalid syntax.</exception>
|
|
/// <exception cref="T:System.ArgumentNullException">
|
|
/// <paramref name="assemblyname" /> or <paramref name="regexinfos" /> is null. </exception>
|
|
/// <PermissionSet>
|
|
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
|
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="ControlEvidence" />
|
|
/// </PermissionSet>
|
|
// Token: 0x0600192D RID: 6445 RVA: 0x000561A4 File Offset: 0x000543A4
|
|
[global::System.MonoTODO]
|
|
public static void CompileToAssembly(RegexCompilationInfo[] regexes, AssemblyName aname)
|
|
{
|
|
Regex.CompileToAssembly(regexes, aname, new CustomAttributeBuilder[0], null);
|
|
}
|
|
|
|
/// <summary>Compiles one or more specified <see cref="T:System.Text.RegularExpressions.Regex" /> objects to a named file with specified attributes.</summary>
|
|
/// <param name="regexinfos">An array that describes the regular expressions to compile. </param>
|
|
/// <param name="assemblyname">The file name of the assembly. </param>
|
|
/// <param name="attributes">An array that defines the attributes to apply to the assembly. </param>
|
|
/// <exception cref="T:System.ArgumentException">The value of the <paramref name="assemblyname" /> parameter's <see cref="P:System.Reflection.AssemblyName.Name" /> property is an empty or null string.-or-The regular expression pattern of one or more objects in <paramref name="regexinfos" /> contains invalid syntax.</exception>
|
|
/// <exception cref="T:System.ArgumentNullException">
|
|
/// <paramref name="assemblyname" /> or <paramref name="regexinfos" /> is null. </exception>
|
|
/// <PermissionSet>
|
|
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
|
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="ControlEvidence" />
|
|
/// </PermissionSet>
|
|
// Token: 0x0600192E RID: 6446 RVA: 0x000561B4 File Offset: 0x000543B4
|
|
[global::System.MonoTODO]
|
|
public static void CompileToAssembly(RegexCompilationInfo[] regexes, AssemblyName aname, CustomAttributeBuilder[] attribs)
|
|
{
|
|
Regex.CompileToAssembly(regexes, aname, attribs, null);
|
|
}
|
|
|
|
/// <summary>Compiles one or more specified <see cref="T:System.Text.RegularExpressions.Regex" /> objects and a specified resource file to a named assembly with specified attributes.</summary>
|
|
/// <param name="regexinfos">An array that describes the regular expressions to compile. </param>
|
|
/// <param name="assemblyname">The file name of the assembly. </param>
|
|
/// <param name="attributes">An array that defines the attributes to apply to the assembly. </param>
|
|
/// <param name="resourceFile">The name of the Win32 resource file to include in the assembly. </param>
|
|
/// <exception cref="T:System.ArgumentException">The value of the <paramref name="assemblyname" /> parameter's <see cref="P:System.Reflection.AssemblyName.Name" /> property is an empty or null string.-or-The regular expression pattern of one or more objects in <paramref name="regexinfos" /> contains invalid syntax.</exception>
|
|
/// <exception cref="T:System.ArgumentNullException">
|
|
/// <paramref name="assemblyname" /> or <paramref name="regexinfos" /> is null. </exception>
|
|
/// <exception cref="T:System.Runtime.InteropServices.COMException">The <paramref name="resourceFile" /> parameter designates an invalid Win32 resource file.</exception>
|
|
/// <exception cref="T:System.IO.FileNotFoundException">The file designated by the <paramref name="resourceFile" /> parameter cannot be found. </exception>
|
|
/// <PermissionSet>
|
|
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
|
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="ControlEvidence" />
|
|
/// </PermissionSet>
|
|
// Token: 0x0600192F RID: 6447 RVA: 0x000561C0 File Offset: 0x000543C0
|
|
[global::System.MonoTODO]
|
|
public static void CompileToAssembly(RegexCompilationInfo[] regexes, AssemblyName aname, CustomAttributeBuilder[] attribs, string resourceFile)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
/// <summary>Escapes a minimal set of characters (\, *, +, ?, |, {, [, (,), ^, $,., #, and white space) by replacing them with their escape codes. This instructs the regular expression engine to interpret these characters literally rather than as metacharacters.</summary>
|
|
/// <returns>A string of characters with metacharacters converted to their escaped form.</returns>
|
|
/// <param name="str">The input string containing the text to convert. </param>
|
|
/// <exception cref="T:System.ArgumentNullException">
|
|
/// <paramref name="str" /> is null.</exception>
|
|
// Token: 0x06001930 RID: 6448 RVA: 0x000561C8 File Offset: 0x000543C8
|
|
public static string Escape(string str)
|
|
{
|
|
if (str == null)
|
|
{
|
|
throw new ArgumentNullException("str");
|
|
}
|
|
return global::System.Text.RegularExpressions.Syntax.Parser.Escape(str);
|
|
}
|
|
|
|
/// <summary>Converts any escaped characters in the input string.</summary>
|
|
/// <returns>A string of characters with any escaped characters converted to their unescaped form.</returns>
|
|
/// <param name="str">The input string containing the text to convert. </param>
|
|
/// <exception cref="T:System.ArgumentException">
|
|
/// <paramref name="str" /> includes an unrecognized escape sequence.</exception>
|
|
/// <exception cref="T:System.ArgumentNullException">
|
|
/// <paramref name="str" /> is null.</exception>
|
|
// Token: 0x06001931 RID: 6449 RVA: 0x000561E4 File Offset: 0x000543E4
|
|
public static string Unescape(string str)
|
|
{
|
|
if (str == null)
|
|
{
|
|
throw new ArgumentNullException("str");
|
|
}
|
|
return global::System.Text.RegularExpressions.Syntax.Parser.Unescape(str);
|
|
}
|
|
|
|
/// <summary>Indicates whether the regular expression finds a match in the input string using the regular expression specified in the <paramref name="pattern" /> parameter.</summary>
|
|
/// <returns>true if the regular expression finds a match; otherwise, false.</returns>
|
|
/// <param name="input">The string to search for a match. </param>
|
|
/// <param name="pattern">The regular expression pattern to match. </param>
|
|
/// <exception cref="T:System.ArgumentException">A regular expression parsing error has occurred.</exception>
|
|
/// <exception cref="T:System.ArgumentNullException">
|
|
/// <paramref name="input" /> is null.-or-<paramref name="pattern" /> is null.</exception>
|
|
/// <PermissionSet>
|
|
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
|
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="ControlEvidence" />
|
|
/// </PermissionSet>
|
|
// Token: 0x06001932 RID: 6450 RVA: 0x00056200 File Offset: 0x00054400
|
|
public static bool IsMatch(string input, string pattern)
|
|
{
|
|
return Regex.IsMatch(input, pattern, RegexOptions.None);
|
|
}
|
|
|
|
/// <summary>Indicates whether the regular expression finds a match in the input string, using the regular expression specified in the <paramref name="pattern" /> parameter and the matching options supplied in the <paramref name="options" /> parameter.</summary>
|
|
/// <returns>true if the regular expression finds a match; otherwise, false.</returns>
|
|
/// <param name="input">The string to search for a match. </param>
|
|
/// <param name="pattern">The regular expression pattern to match. </param>
|
|
/// <param name="options">A bitwise OR combination of the enumeration values. </param>
|
|
/// <exception cref="T:System.ArgumentException">A regular expression parsing error has occurred.</exception>
|
|
/// <exception cref="T:System.ArgumentNullException">
|
|
/// <paramref name="input" /> is null.-or-<paramref name="pattern" /> is null.</exception>
|
|
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
|
/// <paramref name="options" /> is not a valid <see cref="T:System.Text.RegularExpressions.RegexOptions" /> value.</exception>
|
|
/// <PermissionSet>
|
|
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
|
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="ControlEvidence" />
|
|
/// </PermissionSet>
|
|
// Token: 0x06001933 RID: 6451 RVA: 0x0005620C File Offset: 0x0005440C
|
|
public static bool IsMatch(string input, string pattern, RegexOptions options)
|
|
{
|
|
Regex regex = new Regex(pattern, options);
|
|
return regex.IsMatch(input);
|
|
}
|
|
|
|
/// <summary>Searches the specified input string for the first occurrence of the regular expression supplied in the <paramref name="pattern" /> parameter.</summary>
|
|
/// <returns>An object that contains information about the match.</returns>
|
|
/// <param name="input">The string to search for a match. </param>
|
|
/// <param name="pattern">The regular expression pattern to match. </param>
|
|
/// <exception cref="T:System.ArgumentException">A regular expression parsing error has occurred.</exception>
|
|
/// <exception cref="T:System.ArgumentNullException">
|
|
/// <paramref name="input" /> is null. -or-<paramref name="pattern" /> is null.</exception>
|
|
/// <PermissionSet>
|
|
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
|
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="ControlEvidence" />
|
|
/// </PermissionSet>
|
|
// Token: 0x06001934 RID: 6452 RVA: 0x00056228 File Offset: 0x00054428
|
|
public static Match Match(string input, string pattern)
|
|
{
|
|
return Regex.Match(input, pattern, RegexOptions.None);
|
|
}
|
|
|
|
/// <summary>Searches the input string for the first occurrence of the regular expression supplied in a <paramref name="pattern" /> parameter, using the matching options supplied in the <paramref name="options" /> parameter.</summary>
|
|
/// <returns>An object that contains information about the match.</returns>
|
|
/// <param name="input">The string to be tested for a match. </param>
|
|
/// <param name="pattern">The regular expression pattern to match. </param>
|
|
/// <param name="options">A bitwise OR combination of the enumeration values. </param>
|
|
/// <exception cref="T:System.ArgumentException">A regular expression parsing error has occurred.</exception>
|
|
/// <exception cref="T:System.ArgumentNullException">
|
|
/// <paramref name="input" /> is null.-or-<paramref name="pattern" /> is null.</exception>
|
|
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
|
/// <paramref name="options" /> is not a valid bitwise combination of <see cref="T:System.Text.RegularExpressions.RegexOptions" /> values.</exception>
|
|
/// <PermissionSet>
|
|
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
|
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="ControlEvidence" />
|
|
/// </PermissionSet>
|
|
// Token: 0x06001935 RID: 6453 RVA: 0x00056234 File Offset: 0x00054434
|
|
public static Match Match(string input, string pattern, RegexOptions options)
|
|
{
|
|
Regex regex = new Regex(pattern, options);
|
|
return regex.Match(input);
|
|
}
|
|
|
|
/// <summary>Searches the specified input string for all occurrences of the regular expression specified in the <paramref name="pattern" /> parameter.</summary>
|
|
/// <returns>A collection of the <see cref="T:System.Text.RegularExpressions.Match" /> objects found by the search. If no matches are found, the method returns an empty collection object.</returns>
|
|
/// <param name="input">The string to search for a match. </param>
|
|
/// <param name="pattern">The regular expression pattern to match. </param>
|
|
/// <exception cref="T:System.ArgumentException">A regular expression parsing error has occurred.</exception>
|
|
/// <exception cref="T:System.ArgumentNullException">
|
|
/// <paramref name="input" /> is null.-or-<paramref name="pattern" /> is null.</exception>
|
|
/// <PermissionSet>
|
|
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
|
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="ControlEvidence" />
|
|
/// </PermissionSet>
|
|
// Token: 0x06001936 RID: 6454 RVA: 0x00056250 File Offset: 0x00054450
|
|
public static MatchCollection Matches(string input, string pattern)
|
|
{
|
|
return Regex.Matches(input, pattern, RegexOptions.None);
|
|
}
|
|
|
|
/// <summary>Searches the specified input string for all occurrences of a specified regular expression, using the specified matching options.</summary>
|
|
/// <returns>A collection of the <see cref="T:System.Text.RegularExpressions.Match" /> objects found by the search. If no matches are found, the method returns an empty collection object.</returns>
|
|
/// <param name="input">The string to search for a match. </param>
|
|
/// <param name="pattern">The regular expression pattern to match. </param>
|
|
/// <param name="options">A bitwise combination of the enumeration values that specify options for matching.</param>
|
|
/// <exception cref="T:System.ArgumentException">A regular expression parsing error has occurred.</exception>
|
|
/// <exception cref="T:System.ArgumentNullException">
|
|
/// <paramref name="input" /> is null.-or-<paramref name="pattern" /> is null.</exception>
|
|
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
|
/// <paramref name="options" /> is not a valid bitwise combination of <see cref="T:System.Text.RegularExpressions.RegexOptions" /> values.</exception>
|
|
/// <PermissionSet>
|
|
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
|
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="ControlEvidence" />
|
|
/// </PermissionSet>
|
|
// Token: 0x06001937 RID: 6455 RVA: 0x0005625C File Offset: 0x0005445C
|
|
public static MatchCollection Matches(string input, string pattern, RegexOptions options)
|
|
{
|
|
Regex regex = new Regex(pattern, options);
|
|
return regex.Matches(input);
|
|
}
|
|
|
|
/// <summary>Within a specified input string, replaces all strings that match a specified regular expression with a string returned by a <see cref="T:System.Text.RegularExpressions.MatchEvaluator" /> delegate.</summary>
|
|
/// <returns>A new string that is identical to the input string, except that a replacement string takes the place of each matched string.</returns>
|
|
/// <param name="input">The string to search for a match. </param>
|
|
/// <param name="pattern">The regular expression pattern to match. </param>
|
|
/// <param name="evaluator">A custom method that examines each match and returns either the original matched string or a replacement string.</param>
|
|
/// <exception cref="T:System.ArgumentException">A regular expression parsing error has occurred.</exception>
|
|
/// <exception cref="T:System.ArgumentNullException">
|
|
/// <paramref name="input" /> is null.-or-<paramref name="pattern" /> is null.-or-<paramref name="evaluator" /> is null.</exception>
|
|
/// <PermissionSet>
|
|
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
|
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="ControlEvidence" />
|
|
/// </PermissionSet>
|
|
// Token: 0x06001938 RID: 6456 RVA: 0x00056278 File Offset: 0x00054478
|
|
public static string Replace(string input, string pattern, MatchEvaluator evaluator)
|
|
{
|
|
return Regex.Replace(input, pattern, evaluator, RegexOptions.None);
|
|
}
|
|
|
|
/// <summary>Within a specified input string, replaces all strings that match a specified regular expression with a string returned by a <see cref="T:System.Text.RegularExpressions.MatchEvaluator" /> delegate. Specified options modify the matching operation.</summary>
|
|
/// <returns>A new string that is identical to the input string, except that a replacement string takes the place of each matched string.</returns>
|
|
/// <param name="input">The string to search for a match. </param>
|
|
/// <param name="pattern">The regular expression pattern to match. </param>
|
|
/// <param name="evaluator">A custom method that examines each match and returns either the original matched string or a replacement string. </param>
|
|
/// <param name="options">A bitwise OR combination of the enumeration values. </param>
|
|
/// <exception cref="T:System.ArgumentException">A regular expression parsing error has occurred.</exception>
|
|
/// <exception cref="T:System.ArgumentNullException">
|
|
/// <paramref name="input" /> is null.-or-<paramref name="pattern" /> is null.-or-<paramref name="evaluator" /> is null.</exception>
|
|
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
|
/// <paramref name="options" /> is not a valid bitwise combination of <see cref="T:System.Text.RegularExpressions.RegexOptions" /> values.</exception>
|
|
/// <PermissionSet>
|
|
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
|
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="ControlEvidence" />
|
|
/// </PermissionSet>
|
|
// Token: 0x06001939 RID: 6457 RVA: 0x00056284 File Offset: 0x00054484
|
|
public static string Replace(string input, string pattern, MatchEvaluator evaluator, RegexOptions options)
|
|
{
|
|
Regex regex = new Regex(pattern, options);
|
|
return regex.Replace(input, evaluator);
|
|
}
|
|
|
|
/// <summary>Within a specified input string, replaces all strings that match a specified regular expression with a specified replacement string. </summary>
|
|
/// <returns>A new string that is identical to the input string, except that a replacement string takes the place of each matched string.</returns>
|
|
/// <param name="input">The string to search for a match. </param>
|
|
/// <param name="pattern">The regular expression pattern to match. </param>
|
|
/// <param name="replacement">The replacement string. </param>
|
|
/// <exception cref="T:System.ArgumentException">A regular expression parsing error has occurred.</exception>
|
|
/// <exception cref="T:System.ArgumentNullException">
|
|
/// <paramref name="input" /> is null.-or-<paramref name="pattern" /> is null.-or-<paramref name="replacement" /> is null.</exception>
|
|
/// <PermissionSet>
|
|
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
|
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="ControlEvidence" />
|
|
/// </PermissionSet>
|
|
// Token: 0x0600193A RID: 6458 RVA: 0x000562A4 File Offset: 0x000544A4
|
|
public static string Replace(string input, string pattern, string replacement)
|
|
{
|
|
return Regex.Replace(input, pattern, replacement, RegexOptions.None);
|
|
}
|
|
|
|
/// <summary>Within a specified input string, replaces all strings that match a specified regular expression with a specified replacement string. Specified options modify the matching operation. </summary>
|
|
/// <returns>A new string that is identical to the input string, except that a replacement string takes the place of each matched string.</returns>
|
|
/// <param name="input">The string to search for a match. </param>
|
|
/// <param name="pattern">The regular expression pattern to match. </param>
|
|
/// <param name="replacement">The replacement string. </param>
|
|
/// <param name="options">A bitwise OR combination of the enumeration values. </param>
|
|
/// <exception cref="T:System.ArgumentException">A regular expression parsing error has occurred.</exception>
|
|
/// <exception cref="T:System.ArgumentNullException">
|
|
/// <paramref name="input" /> is null.-or-<paramref name="pattern" /> is null.-or-<paramref name="replacement" /> is null.</exception>
|
|
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
|
/// <paramref name="options" /> is not a valid bitwise combination of <see cref="T:System.Text.RegularExpressions.RegexOptions" /> values.</exception>
|
|
/// <PermissionSet>
|
|
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
|
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="ControlEvidence" />
|
|
/// </PermissionSet>
|
|
// Token: 0x0600193B RID: 6459 RVA: 0x000562B0 File Offset: 0x000544B0
|
|
public static string Replace(string input, string pattern, string replacement, RegexOptions options)
|
|
{
|
|
Regex regex = new Regex(pattern, options);
|
|
return regex.Replace(input, replacement);
|
|
}
|
|
|
|
/// <summary>Splits the input string at the positions defined by a regular expression pattern.</summary>
|
|
/// <returns>An array of strings.</returns>
|
|
/// <param name="input">The string to split. </param>
|
|
/// <param name="pattern">The regular expression pattern to match. </param>
|
|
/// <exception cref="T:System.ArgumentException">A regular expression parsing error has occurred.</exception>
|
|
/// <exception cref="T:System.ArgumentNullException">
|
|
/// <paramref name="input" /> is null.-or-<paramref name="pattern" /> is null.</exception>
|
|
/// <PermissionSet>
|
|
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
|
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="ControlEvidence" />
|
|
/// </PermissionSet>
|
|
// Token: 0x0600193C RID: 6460 RVA: 0x000562D0 File Offset: 0x000544D0
|
|
public static string[] Split(string input, string pattern)
|
|
{
|
|
return Regex.Split(input, pattern, RegexOptions.None);
|
|
}
|
|
|
|
/// <summary>Splits the input string at the positions defined by a specified regular expression pattern. Specified options modify the matching operation.</summary>
|
|
/// <returns>An array of strings.</returns>
|
|
/// <param name="input">The string to split. </param>
|
|
/// <param name="pattern">The regular expression pattern to match. </param>
|
|
/// <param name="options">A bitwise OR combination of the enumeration values. </param>
|
|
/// <exception cref="T:System.ArgumentException">A regular expression parsing error has occurred.</exception>
|
|
/// <exception cref="T:System.ArgumentNullException">
|
|
/// <paramref name="input" /> is null.-or-<paramref name="pattern" /> is null.</exception>
|
|
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
|
/// <paramref name="options" /> is not a valid bitwise combination of <see cref="T:System.Text.RegularExpressions.RegexOptions" /> values.</exception>
|
|
/// <PermissionSet>
|
|
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
|
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="ControlEvidence" />
|
|
/// </PermissionSet>
|
|
// Token: 0x0600193D RID: 6461 RVA: 0x000562DC File Offset: 0x000544DC
|
|
public static string[] Split(string input, string pattern, RegexOptions options)
|
|
{
|
|
Regex regex = new Regex(pattern, options);
|
|
return regex.Split(input);
|
|
}
|
|
|
|
/// <summary>Gets or sets the maximum number of entries in the current static cache of compiled regular expressions.</summary>
|
|
/// <returns>The maximum number of entries in the static cache.</returns>
|
|
/// <exception cref="T:System.ArgumentOutOfRangeException">The value in a set operation is less than zero.</exception>
|
|
// Token: 0x170007E8 RID: 2024
|
|
// (get) Token: 0x0600193E RID: 6462 RVA: 0x000562F8 File Offset: 0x000544F8
|
|
// (set) Token: 0x0600193F RID: 6463 RVA: 0x00056304 File Offset: 0x00054504
|
|
public static int CacheSize
|
|
{
|
|
get
|
|
{
|
|
return Regex.cache.Capacity;
|
|
}
|
|
set
|
|
{
|
|
if (value < 0)
|
|
{
|
|
throw new ArgumentOutOfRangeException("CacheSize");
|
|
}
|
|
Regex.cache.Capacity = value;
|
|
}
|
|
}
|
|
|
|
// Token: 0x06001940 RID: 6464 RVA: 0x00056324 File Offset: 0x00054524
|
|
private static void validate_options(RegexOptions options)
|
|
{
|
|
if ((options & ~(RegexOptions.IgnoreCase | RegexOptions.Multiline | RegexOptions.ExplicitCapture | RegexOptions.Singleline | RegexOptions.IgnorePatternWhitespace | RegexOptions.RightToLeft | RegexOptions.ECMAScript | RegexOptions.CultureInvariant)) != RegexOptions.None)
|
|
{
|
|
throw new ArgumentOutOfRangeException("options");
|
|
}
|
|
if ((options & RegexOptions.ECMAScript) != RegexOptions.None && (options & ~(RegexOptions.IgnoreCase | RegexOptions.Multiline | RegexOptions.ECMAScript)) != RegexOptions.None)
|
|
{
|
|
throw new ArgumentOutOfRangeException("options");
|
|
}
|
|
}
|
|
|
|
// Token: 0x06001941 RID: 6465 RVA: 0x0005636C File Offset: 0x0005456C
|
|
private void Init()
|
|
{
|
|
this.machineFactory = Regex.cache.Lookup(this.pattern, this.roptions);
|
|
if (this.machineFactory == null)
|
|
{
|
|
this.InitNewRegex();
|
|
}
|
|
else
|
|
{
|
|
this.group_count = this.machineFactory.GroupCount;
|
|
this.gap = this.machineFactory.Gap;
|
|
this.mapping = this.machineFactory.Mapping;
|
|
this.group_names = this.machineFactory.NamesMapping;
|
|
}
|
|
}
|
|
|
|
// Token: 0x06001942 RID: 6466 RVA: 0x000563F0 File Offset: 0x000545F0
|
|
private void InitNewRegex()
|
|
{
|
|
this.machineFactory = Regex.CreateMachineFactory(this.pattern, this.roptions);
|
|
Regex.cache.Add(this.pattern, this.roptions, this.machineFactory);
|
|
this.group_count = this.machineFactory.GroupCount;
|
|
this.gap = this.machineFactory.Gap;
|
|
this.mapping = this.machineFactory.Mapping;
|
|
this.group_names = this.machineFactory.NamesMapping;
|
|
}
|
|
|
|
// Token: 0x06001943 RID: 6467 RVA: 0x00056474 File Offset: 0x00054674
|
|
private static IMachineFactory CreateMachineFactory(string pattern, RegexOptions options)
|
|
{
|
|
global::System.Text.RegularExpressions.Syntax.Parser parser = new global::System.Text.RegularExpressions.Syntax.Parser();
|
|
global::System.Text.RegularExpressions.Syntax.RegularExpression regularExpression = parser.ParseRegularExpression(pattern, options);
|
|
ICompiler compiler = new PatternCompiler();
|
|
regularExpression.Compile(compiler, (options & RegexOptions.RightToLeft) != RegexOptions.None);
|
|
IMachineFactory machineFactory = compiler.GetMachineFactory();
|
|
Hashtable hashtable = new Hashtable();
|
|
machineFactory.Gap = parser.GetMapping(hashtable);
|
|
machineFactory.Mapping = hashtable;
|
|
machineFactory.NamesMapping = Regex.GetGroupNamesArray(machineFactory.GroupCount, machineFactory.Mapping);
|
|
return machineFactory;
|
|
}
|
|
|
|
/// <summary>Returns the options passed into the <see cref="T:System.Text.RegularExpressions.Regex" /> constructor.</summary>
|
|
/// <returns>The <paramref name="options" /> parameter that was passed into the <see cref="T:System.Text.RegularExpressions.Regex" /> constructor.</returns>
|
|
// Token: 0x170007E9 RID: 2025
|
|
// (get) Token: 0x06001944 RID: 6468 RVA: 0x000564E4 File Offset: 0x000546E4
|
|
public RegexOptions Options
|
|
{
|
|
get
|
|
{
|
|
return this.roptions;
|
|
}
|
|
}
|
|
|
|
/// <summary>Gets a value indicating whether the regular expression searches from right to left.</summary>
|
|
/// <returns>true if the regular expression searches from right to left; otherwise false.</returns>
|
|
// Token: 0x170007EA RID: 2026
|
|
// (get) Token: 0x06001945 RID: 6469 RVA: 0x000564EC File Offset: 0x000546EC
|
|
public bool RightToLeft
|
|
{
|
|
get
|
|
{
|
|
return (this.roptions & RegexOptions.RightToLeft) != RegexOptions.None;
|
|
}
|
|
}
|
|
|
|
/// <summary>Returns an array of capturing group names for the regular expression.</summary>
|
|
/// <returns>A string array of group names.</returns>
|
|
/// <PermissionSet>
|
|
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode" />
|
|
/// </PermissionSet>
|
|
// Token: 0x06001946 RID: 6470 RVA: 0x00056500 File Offset: 0x00054700
|
|
public string[] GetGroupNames()
|
|
{
|
|
string[] array = new string[1 + this.group_count];
|
|
Array.Copy(this.group_names, array, 1 + this.group_count);
|
|
return array;
|
|
}
|
|
|
|
/// <summary>Returns an array of capturing group numbers that correspond to group names in an array.</summary>
|
|
/// <returns>An integer array of group numbers.</returns>
|
|
// Token: 0x06001947 RID: 6471 RVA: 0x00056530 File Offset: 0x00054730
|
|
public int[] GetGroupNumbers()
|
|
{
|
|
int[] array = new int[1 + this.group_count];
|
|
Array.Copy(this.GroupNumbers, array, 1 + this.group_count);
|
|
return array;
|
|
}
|
|
|
|
/// <summary>Returns the group name that corresponds to the specified group number.</summary>
|
|
/// <returns>A string that contains the group name associated with the specified group number. If there is no group name that corresponds to <paramref name="i" />, the method returns <see cref="F:System.String.Empty" />.</returns>
|
|
/// <param name="i">The group number to convert to the corresponding group name. </param>
|
|
// Token: 0x06001948 RID: 6472 RVA: 0x00056560 File Offset: 0x00054760
|
|
public string GroupNameFromNumber(int i)
|
|
{
|
|
i = this.GetGroupIndex(i);
|
|
if (i < 0)
|
|
{
|
|
return string.Empty;
|
|
}
|
|
return this.group_names[i];
|
|
}
|
|
|
|
/// <summary>Returns the group number that corresponds to the specified group name.</summary>
|
|
/// <returns>The group number that corresponds to the specified group name.</returns>
|
|
/// <param name="name">The group name to convert to the corresponding group number. </param>
|
|
/// <exception cref="T:System.ArgumentNullException">
|
|
/// <paramref name="name" /> is null.</exception>
|
|
// Token: 0x06001949 RID: 6473 RVA: 0x00056580 File Offset: 0x00054780
|
|
public int GroupNumberFromName(string name)
|
|
{
|
|
if (!this.mapping.Contains(name))
|
|
{
|
|
return -1;
|
|
}
|
|
int num = (int)this.mapping[name];
|
|
if (num >= this.gap)
|
|
{
|
|
num = int.Parse(name);
|
|
}
|
|
return num;
|
|
}
|
|
|
|
// Token: 0x0600194A RID: 6474 RVA: 0x000565C8 File Offset: 0x000547C8
|
|
internal int GetGroupIndex(int number)
|
|
{
|
|
if (number < this.gap)
|
|
{
|
|
return number;
|
|
}
|
|
if (this.gap > this.group_count)
|
|
{
|
|
return -1;
|
|
}
|
|
return Array.BinarySearch<int>(this.GroupNumbers, this.gap, this.group_count - this.gap + 1, number);
|
|
}
|
|
|
|
// Token: 0x0600194B RID: 6475 RVA: 0x00056618 File Offset: 0x00054818
|
|
private int default_startat(string input)
|
|
{
|
|
return (!this.RightToLeft || input == null) ? 0 : input.Length;
|
|
}
|
|
|
|
/// <summary>Indicates whether the regular expression specified in the <see cref="T:System.Text.RegularExpressions.Regex" /> constructor finds a match in the input string.</summary>
|
|
/// <returns>true if the regular expression finds a match; otherwise, false.</returns>
|
|
/// <param name="input">The string to search for a match. </param>
|
|
/// <exception cref="T:System.ArgumentNullException">
|
|
/// <paramref name="input" /> is null.</exception>
|
|
/// <PermissionSet>
|
|
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
|
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="ControlEvidence" />
|
|
/// </PermissionSet>
|
|
// Token: 0x0600194C RID: 6476 RVA: 0x00056638 File Offset: 0x00054838
|
|
public bool IsMatch(string input)
|
|
{
|
|
return this.IsMatch(input, this.default_startat(input));
|
|
}
|
|
|
|
/// <summary>Indicates whether the regular expression specified in the <see cref="T:System.Text.RegularExpressions.Regex" /> constructor finds a match in the input string beginning at the specified starting position in the string.</summary>
|
|
/// <returns>true if the regular expression finds a match; otherwise, false.</returns>
|
|
/// <param name="input">The string to search for a match. </param>
|
|
/// <param name="startat">The character position at which to start the search. </param>
|
|
/// <exception cref="T:System.ArgumentNullException">
|
|
/// <paramref name="input" /> is null.</exception>
|
|
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
|
/// <paramref name="startat" /> cannot be less than zero or greater than the length of <paramref name="input" />.</exception>
|
|
/// <PermissionSet>
|
|
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
|
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="ControlEvidence" />
|
|
/// </PermissionSet>
|
|
// Token: 0x0600194D RID: 6477 RVA: 0x00056648 File Offset: 0x00054848
|
|
public bool IsMatch(string input, int startat)
|
|
{
|
|
return this.Match(input, startat).Success;
|
|
}
|
|
|
|
/// <summary>Searches the specified input string for the first occurrence of the regular expression specified in the <see cref="T:System.Text.RegularExpressions.Regex" /> constructor.</summary>
|
|
/// <returns>An object that contains information about the match.</returns>
|
|
/// <param name="input">The string to search for a match. </param>
|
|
/// <exception cref="T:System.ArgumentNullException">
|
|
/// <paramref name="input" /> is null.</exception>
|
|
/// <PermissionSet>
|
|
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
|
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="ControlEvidence" />
|
|
/// </PermissionSet>
|
|
// Token: 0x0600194E RID: 6478 RVA: 0x00056658 File Offset: 0x00054858
|
|
public Match Match(string input)
|
|
{
|
|
return this.Match(input, this.default_startat(input));
|
|
}
|
|
|
|
/// <summary>Searches the input string for the first occurrence of a regular expression, beginning at the specified starting position in the string.</summary>
|
|
/// <returns>An object that contains information about the match.</returns>
|
|
/// <param name="input">The string to search for a match. </param>
|
|
/// <param name="startat">The zero-based character position at which to start the search. </param>
|
|
/// <exception cref="T:System.ArgumentNullException">
|
|
/// <paramref name="input" /> is null.</exception>
|
|
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
|
/// <paramref name="startat" /> is less than zero or greater than the length of <paramref name="input" />.</exception>
|
|
/// <PermissionSet>
|
|
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
|
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="ControlEvidence" />
|
|
/// </PermissionSet>
|
|
// Token: 0x0600194F RID: 6479 RVA: 0x00056668 File Offset: 0x00054868
|
|
public Match Match(string input, int startat)
|
|
{
|
|
if (input == null)
|
|
{
|
|
throw new ArgumentNullException("input");
|
|
}
|
|
if (startat < 0 || startat > input.Length)
|
|
{
|
|
throw new ArgumentOutOfRangeException("startat");
|
|
}
|
|
return this.CreateMachine().Scan(this, input, startat, input.Length);
|
|
}
|
|
|
|
/// <summary>Searches the input string for the first occurrence of a regular expression, beginning at the specified starting position and searching only the specified number of characters.</summary>
|
|
/// <returns>An object that contains information about the match.</returns>
|
|
/// <param name="input">The string to be tested for a match. </param>
|
|
/// <param name="beginning">The zero-based character position in the input string at which to begin the search. </param>
|
|
/// <param name="length">The number of characters in the substring to include in the search. </param>
|
|
/// <exception cref="T:System.ArgumentNullException">
|
|
/// <paramref name="input" /> is null.</exception>
|
|
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
|
/// <paramref name="beginning" /> is less than zero or greater than the length of <paramref name="input" />.-or-<paramref name="length" /> is less than zero or greater than the length of <paramref name="input" />.</exception>
|
|
/// <PermissionSet>
|
|
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
|
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="ControlEvidence" />
|
|
/// </PermissionSet>
|
|
// Token: 0x06001950 RID: 6480 RVA: 0x000566B8 File Offset: 0x000548B8
|
|
public Match Match(string input, int startat, int length)
|
|
{
|
|
if (input == null)
|
|
{
|
|
throw new ArgumentNullException("input");
|
|
}
|
|
if (startat < 0 || startat > input.Length)
|
|
{
|
|
throw new ArgumentOutOfRangeException("startat");
|
|
}
|
|
if (length < 0 || length > input.Length - startat)
|
|
{
|
|
throw new ArgumentOutOfRangeException("length");
|
|
}
|
|
return this.CreateMachine().Scan(this, input, startat, startat + length);
|
|
}
|
|
|
|
/// <summary>Searches the specified input string for all occurrences of a regular expression.</summary>
|
|
/// <returns>A collection of the <see cref="T:System.Text.RegularExpressions.Match" /> objects found by the search. If no matches are found, the method returns an empty collection object.</returns>
|
|
/// <param name="input">The string to search for a match. </param>
|
|
/// <exception cref="T:System.ArgumentNullException">
|
|
/// <paramref name="input" /> is null.</exception>
|
|
/// <PermissionSet>
|
|
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
|
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="ControlEvidence" />
|
|
/// </PermissionSet>
|
|
// Token: 0x06001951 RID: 6481 RVA: 0x00056728 File Offset: 0x00054928
|
|
public MatchCollection Matches(string input)
|
|
{
|
|
return this.Matches(input, this.default_startat(input));
|
|
}
|
|
|
|
/// <summary>Searches the specified input string for all occurrences of a regular expression, beginning at the specified starting position in the string.</summary>
|
|
/// <returns>A collection of the <see cref="T:System.Text.RegularExpressions.Match" /> objects found by the search. If no matches are found, the method returns an empty collection object.</returns>
|
|
/// <param name="input">The string to search for a match. </param>
|
|
/// <param name="startat">The character position in the input string at which to start the search. </param>
|
|
/// <exception cref="T:System.ArgumentNullException">
|
|
/// <paramref name="input" /> is null.</exception>
|
|
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
|
/// <paramref name="startat" /> is less than zero or greater than the length of <paramref name="input" />.</exception>
|
|
/// <PermissionSet>
|
|
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
|
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="ControlEvidence" />
|
|
/// </PermissionSet>
|
|
// Token: 0x06001952 RID: 6482 RVA: 0x00056738 File Offset: 0x00054938
|
|
public MatchCollection Matches(string input, int startat)
|
|
{
|
|
Match match = this.Match(input, startat);
|
|
return new MatchCollection(match);
|
|
}
|
|
|
|
/// <summary>Within a specified input string, replaces all strings that match a specified regular expression with a string returned by a <see cref="T:System.Text.RegularExpressions.MatchEvaluator" /> delegate. </summary>
|
|
/// <returns>A new string that is identical to the input string, except that a replacement string takes the place of each matched string.</returns>
|
|
/// <param name="input">The string to search for a match. </param>
|
|
/// <param name="evaluator">A custom method that examines each match and returns either the original matched string or a replacement string.</param>
|
|
/// <exception cref="T:System.ArgumentNullException">
|
|
/// <paramref name="input" /> is null.-or-<paramref name="evaluator" /> is null.</exception>
|
|
/// <PermissionSet>
|
|
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
|
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="ControlEvidence" />
|
|
/// </PermissionSet>
|
|
// Token: 0x06001953 RID: 6483 RVA: 0x00056754 File Offset: 0x00054954
|
|
public string Replace(string input, MatchEvaluator evaluator)
|
|
{
|
|
return this.Replace(input, evaluator, int.MaxValue, this.default_startat(input));
|
|
}
|
|
|
|
/// <summary>Within a specified input string, replaces a specified maximum number of strings that match a regular expression pattern with a string returned by a <see cref="T:System.Text.RegularExpressions.MatchEvaluator" /> delegate. </summary>
|
|
/// <returns>A new string that is identical to the input string, except that a replacement string takes the place of each matched string.</returns>
|
|
/// <param name="input">The string to search for a match. </param>
|
|
/// <param name="evaluator">A custom method that examines each match and returns either the original matched string or a replacement string.</param>
|
|
/// <param name="count">The maximum number of times the replacement will occur. </param>
|
|
/// <exception cref="T:System.ArgumentNullException">
|
|
/// <paramref name="input" /> is null.-or-<paramref name="evaluator" /> is null.</exception>
|
|
/// <PermissionSet>
|
|
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
|
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="ControlEvidence" />
|
|
/// </PermissionSet>
|
|
// Token: 0x06001954 RID: 6484 RVA: 0x0005676C File Offset: 0x0005496C
|
|
public string Replace(string input, MatchEvaluator evaluator, int count)
|
|
{
|
|
return this.Replace(input, evaluator, count, this.default_startat(input));
|
|
}
|
|
|
|
/// <summary>Within a specified input substring, replaces a specified maximum number of strings that match a regular expression pattern with a string returned by a <see cref="T:System.Text.RegularExpressions.MatchEvaluator" /> delegate. </summary>
|
|
/// <returns>A new string that is identical to the input string, except that a replacement string takes the place of each matched string.</returns>
|
|
/// <param name="input">The string to search for a match. </param>
|
|
/// <param name="evaluator">A custom method that examines each match and returns either the original matched string or a replacement string.</param>
|
|
/// <param name="count">The maximum number of times the replacement will occur. </param>
|
|
/// <param name="startat">The character position in the input string where the search begins. </param>
|
|
/// <exception cref="T:System.ArgumentNullException">
|
|
/// <paramref name="input" /> is null.-or-<paramref name="evaluator" /> is null.</exception>
|
|
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
|
/// <paramref name="startat" /> is less than zero or greater than the length of <paramref name="input" />.</exception>
|
|
/// <PermissionSet>
|
|
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
|
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="ControlEvidence" />
|
|
/// </PermissionSet>
|
|
// Token: 0x06001955 RID: 6485 RVA: 0x00056780 File Offset: 0x00054980
|
|
public string Replace(string input, MatchEvaluator evaluator, int count, int startat)
|
|
{
|
|
if (input == null)
|
|
{
|
|
throw new ArgumentNullException("input");
|
|
}
|
|
if (evaluator == null)
|
|
{
|
|
throw new ArgumentNullException("evaluator");
|
|
}
|
|
if (count < -1)
|
|
{
|
|
throw new ArgumentOutOfRangeException("count");
|
|
}
|
|
if (startat < 0 || startat > input.Length)
|
|
{
|
|
throw new ArgumentOutOfRangeException("startat");
|
|
}
|
|
BaseMachine baseMachine = (BaseMachine)this.CreateMachine();
|
|
if (this.RightToLeft)
|
|
{
|
|
return baseMachine.RTLReplace(this, input, evaluator, count, startat);
|
|
}
|
|
Regex.Adapter adapter = new Regex.Adapter(evaluator);
|
|
return baseMachine.LTRReplace(this, input, new BaseMachine.MatchAppendEvaluator(adapter.Evaluate), count, startat);
|
|
}
|
|
|
|
/// <summary>Within a specified input string, replaces all strings that match a regular expression pattern with a specified replacement string. </summary>
|
|
/// <returns>A new string that is identical to the input string, except that a replacement string takes the place of each matched string.</returns>
|
|
/// <param name="input">The string to search for a match. </param>
|
|
/// <param name="replacement">The replacement string. </param>
|
|
/// <exception cref="T:System.ArgumentNullException">
|
|
/// <paramref name="input" /> is null.-or-<paramref name="replacement" /> is null.</exception>
|
|
/// <PermissionSet>
|
|
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
|
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="ControlEvidence" />
|
|
/// </PermissionSet>
|
|
// Token: 0x06001956 RID: 6486 RVA: 0x00056824 File Offset: 0x00054A24
|
|
public string Replace(string input, string replacement)
|
|
{
|
|
return this.Replace(input, replacement, int.MaxValue, this.default_startat(input));
|
|
}
|
|
|
|
/// <summary>Within a specified input string, replaces a specified maximum number of strings that match a regular expression pattern with a specified replacement string. </summary>
|
|
/// <returns>A new string that is identical to the input string, except that a replacement string takes the place of each matched string.</returns>
|
|
/// <param name="input">The string to search for a match. </param>
|
|
/// <param name="replacement">The replacement string. </param>
|
|
/// <param name="count">The maximum number of times the replacement can occur. </param>
|
|
/// <exception cref="T:System.ArgumentNullException">
|
|
/// <paramref name="input" /> is null.-or-<paramref name="replacement" /> is null.</exception>
|
|
/// <PermissionSet>
|
|
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
|
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="ControlEvidence" />
|
|
/// </PermissionSet>
|
|
// Token: 0x06001957 RID: 6487 RVA: 0x0005683C File Offset: 0x00054A3C
|
|
public string Replace(string input, string replacement, int count)
|
|
{
|
|
return this.Replace(input, replacement, count, this.default_startat(input));
|
|
}
|
|
|
|
/// <summary>Within a specified input substring, replaces a specified maximum number of strings that match a regular expression pattern with a specified replacement string. </summary>
|
|
/// <returns>A new string that is identical to the input string, except that a replacement string takes the place of each matched string.</returns>
|
|
/// <param name="input">The string to search for a match. </param>
|
|
/// <param name="replacement">The replacement string. </param>
|
|
/// <param name="count">Maximum number of times the replacement can occur. </param>
|
|
/// <param name="startat">The character position in the input string where the search begins. </param>
|
|
/// <exception cref="T:System.ArgumentNullException">
|
|
/// <paramref name="input" /> is null.-or-<paramref name="replacement" /> is null.</exception>
|
|
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
|
/// <paramref name="startat" /> is less than zero or greater than the length of <paramref name="input" />.</exception>
|
|
/// <PermissionSet>
|
|
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
|
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="ControlEvidence" />
|
|
/// </PermissionSet>
|
|
// Token: 0x06001958 RID: 6488 RVA: 0x00056850 File Offset: 0x00054A50
|
|
public string Replace(string input, string replacement, int count, int startat)
|
|
{
|
|
if (input == null)
|
|
{
|
|
throw new ArgumentNullException("input");
|
|
}
|
|
if (replacement == null)
|
|
{
|
|
throw new ArgumentNullException("replacement");
|
|
}
|
|
if (count < -1)
|
|
{
|
|
throw new ArgumentOutOfRangeException("count");
|
|
}
|
|
if (startat < 0 || startat > input.Length)
|
|
{
|
|
throw new ArgumentOutOfRangeException("startat");
|
|
}
|
|
return this.CreateMachine().Replace(this, input, replacement, count, startat);
|
|
}
|
|
|
|
/// <summary>Splits the specified input string at the positions defined by a regular expression pattern specified in the <see cref="T:System.Text.RegularExpressions.Regex" /> constructor.</summary>
|
|
/// <returns>An array of strings.</returns>
|
|
/// <param name="input">The string to split. </param>
|
|
/// <exception cref="T:System.ArgumentNullException">
|
|
/// <paramref name="input" /> is null.</exception>
|
|
/// <PermissionSet>
|
|
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
|
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="ControlEvidence" />
|
|
/// </PermissionSet>
|
|
// Token: 0x06001959 RID: 6489 RVA: 0x000568C4 File Offset: 0x00054AC4
|
|
public string[] Split(string input)
|
|
{
|
|
return this.Split(input, int.MaxValue, this.default_startat(input));
|
|
}
|
|
|
|
/// <summary>Splits the specified input string a specified maximum number of times at the positions defined by a regular expression specified in the <see cref="T:System.Text.RegularExpressions.Regex" /> constructor.</summary>
|
|
/// <returns>An array of strings.</returns>
|
|
/// <param name="input">The string to be split. </param>
|
|
/// <param name="count">The maximum number of times the split can occur. </param>
|
|
/// <exception cref="T:System.ArgumentNullException">
|
|
/// <paramref name="input" /> is null.</exception>
|
|
/// <PermissionSet>
|
|
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
|
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="ControlEvidence" />
|
|
/// </PermissionSet>
|
|
// Token: 0x0600195A RID: 6490 RVA: 0x000568DC File Offset: 0x00054ADC
|
|
public string[] Split(string input, int count)
|
|
{
|
|
return this.Split(input, count, this.default_startat(input));
|
|
}
|
|
|
|
/// <summary>Splits the specified input string a specified maximum number of times at the positions defined by a regular expression specified in the <see cref="T:System.Text.RegularExpressions.Regex" /> constructor. The search for the regular expression pattern starts at a specified character position in the input string.</summary>
|
|
/// <returns>An array of strings.</returns>
|
|
/// <param name="input">The string to be split. </param>
|
|
/// <param name="count">The maximum number of times the split can occur. </param>
|
|
/// <param name="startat">The character position in the input string where the search will begin. </param>
|
|
/// <exception cref="T:System.ArgumentNullException">
|
|
/// <paramref name="input" /> is null.</exception>
|
|
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
|
/// <paramref name="startat" /> is less than zero or greater than the length of <paramref name="input" />.</exception>
|
|
/// <PermissionSet>
|
|
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
|
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="ControlEvidence" />
|
|
/// </PermissionSet>
|
|
// Token: 0x0600195B RID: 6491 RVA: 0x000568F0 File Offset: 0x00054AF0
|
|
public string[] Split(string input, int count, int startat)
|
|
{
|
|
if (input == null)
|
|
{
|
|
throw new ArgumentNullException("input");
|
|
}
|
|
if (count < 0)
|
|
{
|
|
throw new ArgumentOutOfRangeException("count");
|
|
}
|
|
if (startat < 0 || startat > input.Length)
|
|
{
|
|
throw new ArgumentOutOfRangeException("startat");
|
|
}
|
|
return this.CreateMachine().Split(this, input, count, startat);
|
|
}
|
|
|
|
/// <summary>Used by a <see cref="T:System.Text.RegularExpressions.Regex" /> object generated by the <see cref="Overload:System.Text.RegularExpressions.Regex.CompileToAssembly" /> method. </summary>
|
|
/// <exception cref="T:System.NotSupportedException">References have already been initialized. </exception>
|
|
// Token: 0x0600195C RID: 6492 RVA: 0x00056950 File Offset: 0x00054B50
|
|
protected void InitializeReferences()
|
|
{
|
|
if (this.refsInitialized)
|
|
{
|
|
throw new NotSupportedException("This operation is only allowed once per object.");
|
|
}
|
|
this.refsInitialized = true;
|
|
this.Init();
|
|
}
|
|
|
|
/// <summary>Used by a <see cref="T:System.Text.RegularExpressions.Regex" /> object generated by the <see cref="Overload:System.Text.RegularExpressions.Regex.CompileToAssembly" /> method.</summary>
|
|
/// <returns>true if the <see cref="P:System.Text.RegularExpressions.Regex.Options" /> property contains the <see cref="F:System.Text.RegularExpressions.RegexOptions.RightToLeft" /> option; otherwise, false.</returns>
|
|
// Token: 0x0600195D RID: 6493 RVA: 0x00056978 File Offset: 0x00054B78
|
|
protected bool UseOptionR()
|
|
{
|
|
return (this.roptions & RegexOptions.RightToLeft) != RegexOptions.None;
|
|
}
|
|
|
|
/// <summary>Returns the regular expression pattern that was passed into the Regex constructor.</summary>
|
|
/// <returns>The <paramref name="pattern" /> parameter that was passed into the Regex constructor.</returns>
|
|
// Token: 0x0600195E RID: 6494 RVA: 0x0005698C File Offset: 0x00054B8C
|
|
public override string ToString()
|
|
{
|
|
return this.pattern;
|
|
}
|
|
|
|
// Token: 0x170007EB RID: 2027
|
|
// (get) Token: 0x0600195F RID: 6495 RVA: 0x00056994 File Offset: 0x00054B94
|
|
internal int GroupCount
|
|
{
|
|
get
|
|
{
|
|
return this.group_count;
|
|
}
|
|
}
|
|
|
|
// Token: 0x170007EC RID: 2028
|
|
// (get) Token: 0x06001960 RID: 6496 RVA: 0x0005699C File Offset: 0x00054B9C
|
|
internal int Gap
|
|
{
|
|
get
|
|
{
|
|
return this.gap;
|
|
}
|
|
}
|
|
|
|
// Token: 0x06001961 RID: 6497 RVA: 0x000569A4 File Offset: 0x00054BA4
|
|
private IMachine CreateMachine()
|
|
{
|
|
return this.machineFactory.NewInstance();
|
|
}
|
|
|
|
// Token: 0x06001962 RID: 6498 RVA: 0x000569B4 File Offset: 0x00054BB4
|
|
private static string[] GetGroupNamesArray(int groupCount, IDictionary mapping)
|
|
{
|
|
string[] array = new string[groupCount + 1];
|
|
IDictionaryEnumerator enumerator = mapping.GetEnumerator();
|
|
while (enumerator.MoveNext())
|
|
{
|
|
array[(int)enumerator.Value] = (string)enumerator.Key;
|
|
}
|
|
return array;
|
|
}
|
|
|
|
// Token: 0x170007ED RID: 2029
|
|
// (get) Token: 0x06001963 RID: 6499 RVA: 0x000569FC File Offset: 0x00054BFC
|
|
private int[] GroupNumbers
|
|
{
|
|
get
|
|
{
|
|
if (this.group_numbers == null)
|
|
{
|
|
this.group_numbers = new int[1 + this.group_count];
|
|
for (int i = 0; i < this.gap; i++)
|
|
{
|
|
this.group_numbers[i] = i;
|
|
}
|
|
for (int j = this.gap; j <= this.group_count; j++)
|
|
{
|
|
this.group_numbers[j] = int.Parse(this.group_names[j]);
|
|
}
|
|
return this.group_numbers;
|
|
}
|
|
return this.group_numbers;
|
|
}
|
|
}
|
|
|
|
// Token: 0x040013D4 RID: 5076
|
|
private static FactoryCache cache = new FactoryCache(15);
|
|
|
|
// Token: 0x040013D5 RID: 5077
|
|
private IMachineFactory machineFactory;
|
|
|
|
// Token: 0x040013D6 RID: 5078
|
|
private IDictionary mapping;
|
|
|
|
// Token: 0x040013D7 RID: 5079
|
|
private int group_count;
|
|
|
|
// Token: 0x040013D8 RID: 5080
|
|
private int gap;
|
|
|
|
// Token: 0x040013D9 RID: 5081
|
|
private bool refsInitialized;
|
|
|
|
// Token: 0x040013DA RID: 5082
|
|
private string[] group_names;
|
|
|
|
// Token: 0x040013DB RID: 5083
|
|
private int[] group_numbers;
|
|
|
|
/// <summary>Used by a <see cref="T:System.Text.RegularExpressions.Regex" /> object generated by the <see cref="Overload:System.Text.RegularExpressions.Regex.CompileToAssembly" /> method. </summary>
|
|
// Token: 0x040013DC RID: 5084
|
|
protected internal string pattern;
|
|
|
|
/// <summary>Used by a <see cref="T:System.Text.RegularExpressions.Regex" /> object generated by the <see cref="Overload:System.Text.RegularExpressions.Regex.CompileToAssembly" /> method. </summary>
|
|
// Token: 0x040013DD RID: 5085
|
|
protected internal RegexOptions roptions;
|
|
|
|
/// <summary>Used by a <see cref="T:System.Text.RegularExpressions.Regex" /> object generated by the <see cref="Overload:System.Text.RegularExpressions.Regex.CompileToAssembly" /> method. </summary>
|
|
// Token: 0x040013DE RID: 5086
|
|
[global::System.MonoTODO]
|
|
internal Dictionary<string, int> capnames;
|
|
|
|
/// <summary>Used by a <see cref="T:System.Text.RegularExpressions.Regex" /> object generated by the <see cref="Overload:System.Text.RegularExpressions.Regex.CompileToAssembly" /> method. </summary>
|
|
// Token: 0x040013DF RID: 5087
|
|
[global::System.MonoTODO]
|
|
internal Dictionary<int, int> caps;
|
|
|
|
/// <summary>Used by a <see cref="T:System.Text.RegularExpressions.Regex" /> object generated by the <see cref="Overload:System.Text.RegularExpressions.Regex.CompileToAssembly" /> method. </summary>
|
|
// Token: 0x040013E0 RID: 5088
|
|
[global::System.MonoTODO]
|
|
protected internal int capsize;
|
|
|
|
/// <summary>Used by a <see cref="T:System.Text.RegularExpressions.Regex" /> object generated by the <see cref="Overload:System.Text.RegularExpressions.Regex.CompileToAssembly" /> method. </summary>
|
|
// Token: 0x040013E1 RID: 5089
|
|
[global::System.MonoTODO]
|
|
protected internal string[] capslist;
|
|
|
|
// Token: 0x020002B3 RID: 691
|
|
private class Adapter
|
|
{
|
|
// Token: 0x06001964 RID: 6500 RVA: 0x00056A88 File Offset: 0x00054C88
|
|
public Adapter(MatchEvaluator ev)
|
|
{
|
|
this.ev = ev;
|
|
}
|
|
|
|
// Token: 0x06001965 RID: 6501 RVA: 0x00056A98 File Offset: 0x00054C98
|
|
public void Evaluate(Match m, StringBuilder sb)
|
|
{
|
|
sb.Append(this.ev(m));
|
|
}
|
|
|
|
// Token: 0x040013E2 RID: 5090
|
|
private MatchEvaluator ev;
|
|
}
|
|
}
|
|
}
|