asp.net正则表达式类的定义

本文深入探讨了正则表达式的实现细节,包括构造、匹配、分组、替换等功能,详细介绍了其内部数据结构和关键方法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

using System;
using System.Collections;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime;
using System.Runtime.Serialization;

namespace System.Text.RegularExpressions
{
    [Serializable]
    public class Regex : ISerializable
    {
        protected internal Hashtable capnames;
        protected internal Hashtable caps;
        protected internal int capsize;
        protected internal string[] capslist;
        protected internal RegexRunnerFactory factory;
        protected internal string pattern;
        protected internal RegexOptions roptions;       
        [TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]
        protected Regex();
        [TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]
        public Regex(string pattern);
        protected Regex(SerializationInfo info, StreamingContext context);
        [TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]
        public Regex(string pattern, RegexOptions options);
        public static int CacheSize { get; set; }
        public RegexOptions Options { get; }
        public bool RightToLeft { get; }
        [TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]
        public static void CompileToAssembly(RegexCompilationInfo[] regexinfos, AssemblyName assemblyname);
        [TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]
        public static void CompileToAssembly(RegexCompilationInfo[] regexinfos, AssemblyName assemblyname, CustomAttributeBuilder[] attributes);
        [TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]
        public static void CompileToAssembly(RegexCompilationInfo[] regexinfos, AssemblyName assemblyname, CustomAttributeBuilder[] attributes, string resourceFile);
        public static string Escape(string str);
        public string[] GetGroupNames();
        public int[] GetGroupNumbers();
        public string GroupNameFromNumber(int i);
        public int GroupNumberFromName(string name);
        protected void InitializeReferences();
        public bool IsMatch(string input);
        public bool IsMatch(string input, int startat);
        public static bool IsMatch(string input, string pattern);
        public static bool IsMatch(string input, string pattern, RegexOptions options);
        public Match Match(string input);
        public Match Match(string input, int startat);
        public static Match Match(string input, string pattern);
        public Match Match(string input, int beginning, int length);
        public static Match Match(string input, string pattern, RegexOptions options);
        public MatchCollection Matches(string input);
        public MatchCollection Matches(string input, int startat);
        public static MatchCollection Matches(string input, string pattern);
        public static MatchCollection Matches(string input, string pattern, RegexOptions options);
        public string Replace(string input, MatchEvaluator evaluator);
        public string Replace(string input, string replacement);
        public string Replace(string input, MatchEvaluator evaluator, int count);
        public string Replace(string input, string replacement, int count);
        public static string Replace(string input, string pattern, MatchEvaluator evaluator);
        public static string Replace(string input, string pattern, string replacement);
        public string Replace(string input, MatchEvaluator evaluator, int count, int startat);
        public string Replace(string input, string replacement, int count, int startat);
        public static string Replace(string input, string pattern, MatchEvaluator evaluator, RegexOptions options);
        public static string Replace(string input, string pattern, string replacement, RegexOptions options);
        public string[] Split(string input);
        public string[] Split(string input, int count);
        public static string[] Split(string input, string pattern);
        public string[] Split(string input, int count, int startat);
        public static string[] Split(string input, string pattern, RegexOptions options);
        public override string ToString();
        public static string Unescape(string str);
        protected bool UseOptionC();
        protected bool UseOptionR();
    }
}

 

转载于:https://www.cnblogs.com/sntetwt/p/3409930.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值