Skip to content

API Host ScriptRegex

Liu.Yandong.Hanks edited this page Aug 19, 2026 · 3 revisions

ScriptRegex

System.Text.RegularExpressions.Regex 的脚本正则表达式包装类型。

Script regular expression wrapper over System.Text.RegularExpressions.Regex.

命名空间:AuroraScript.Runtime.Types。类型:class。

Namespace: AuroraScript.Runtime.Types. Kind: class.

返回 .NET Host API 参考

Back to .NET Host API Reference

用途

Purpose

ScriptRegex 是公开宿主类型。通过下方签名选择调用方式;对运行时对象、生命周期和异常,应由宿主在边界处明确处理。

Script regular expression wrapper over System.Text.RegularExpressions.Regex.

简单示例

Simple Example

下面是 ScriptRegex 的最小使用方式。

A minimal use of ScriptRegex.

var regex = new ScriptRegex(
    new Regex("^\\d+$"),
    "");

var matched = regex.Test(ScriptDatum.FromString("42"));
Console.WriteLine(matched); // True

成员

Members

ScriptRegex(Regex regex, string flags)

创建 ScriptRegex 实例。

Use the member according to its public signature.

Parameters:

  • regex
    按签名提供的 Regex 参数。

    The Regex parameter required by the signature.

  • flags
    要应用的标志集合。

    Set of flags to apply.

Returns

新建的 ScriptRegex 实例。

A new ScriptRegex instance.

调用示意

以下示例展示调用形状;将占位实例和参数替换为宿主中的实际值。

The example shows the call shape; replace placeholder instances and arguments with actual host values.

var value = new ScriptRegex(/* 参数 */);

bool Test(ScriptDatum value)

调用 Test 完成其公开操作。

Use the member according to its public signature.

Parameters:

  • value
    要处理、保存或转换的值。

    Value to process, store, or convert.

Returns

返回 bool

Returns bool.

调用示意

以下示例展示调用形状;将占位实例和参数替换为宿主中的实际值。

The example shows the call shape; replace placeholder instances and arguments with actual host values.

ScriptRegex value = /* 从宿主 API 获取实例 */;
var result = value.Test(/* value */);

ScriptObject Match(StringValue str)

调用 Match 完成其公开操作。

Use the member according to its public signature.

Parameters:

  • str
    按签名提供的 StringValue 参数。

    The StringValue parameter required by the signature.

Returns

返回 ScriptObject

Returns ScriptObject.

调用示意

以下示例展示调用形状;将占位实例和参数替换为宿主中的实际值。

The example shows the call shape; replace placeholder instances and arguments with actual host values.

ScriptRegex value = /* 从宿主 API 获取实例 */;
var result = value.Match(/* str */);

ScriptObject MatchOfGlobal(StringValue str)

调用 MatchOfGlobal 完成其公开操作。

Use the member according to its public signature.

Parameters:

  • str
    按签名提供的 StringValue 参数。

    The StringValue parameter required by the signature.

Returns

返回 ScriptObject

Returns ScriptObject.

调用示意

以下示例展示调用形状;将占位实例和参数替换为宿主中的实际值。

The example shows the call shape; replace placeholder instances and arguments with actual host values.

ScriptRegex value = /* 从宿主 API 获取实例 */;
var result = value.MatchOfGlobal(/* str */);

ScriptArray MatchAll(StringValue str)

调用 MatchAll 完成其公开操作。

Use the member according to its public signature.

Parameters:

  • str
    按签名提供的 StringValue 参数。

    The StringValue parameter required by the signature.

Returns

返回 ScriptArray

Returns ScriptArray.

调用示意

以下示例展示调用形状;将占位实例和参数替换为宿主中的实际值。

The example shows the call shape; replace placeholder instances and arguments with actual host values.

ScriptRegex value = /* 从宿主 API 获取实例 */;
var result = value.MatchAll(/* str */);

bool HasFlag(string flag)

调用 HasFlag 完成其公开操作。

Use the member according to its public signature.

Parameters:

  • flag
    要检查或应用的标志。

    Flag to inspect or apply.

Returns

返回 bool

Returns bool.

调用示意

以下示例展示调用形状;将占位实例和参数替换为宿主中的实际值。

The example shows the call shape; replace placeholder instances and arguments with actual host values.

ScriptRegex value = /* 从宿主 API 获取实例 */;
var result = value.HasFlag(/* flag */);

Clone this wiki locally