RegexHelperMatchGroups 方法

获取正则表达式的所有分组匹配结果(不包含整体匹配)。

Definition

命名空间: Suresking.Utility
程序集: Suresking.Utility (在 Suresking.Utility.dll 中) 版本:1.3.22+a27276bb8ffde055e69ff608e98aafba279e1e99
C#
public static string[] MatchGroups(
	string input,
	string pattern,
	RegexOptions options = RegexOptions.None
)

参数

input  String
要匹配的字符串。
pattern  String
包含分组的正则表达式模式,不能为 null 或空。
options  RegexOptions  (Optional)
正则表达式选项(可选)。

返回值

String
分组值的字符串数组;无匹配返回空数组。

备注

未参与匹配的分组其值为空字符串(""),本方法只返回 Value,丢失了 Success 信息。 若需区分"空分组"与"未参与匹配",请直接用 Match(String, String) 遍历 Groups。

异常

ArgumentNullExceptioninput 为 null。
ArgumentExceptionpattern 为 null 或空。

参见