1. Packages
  2. Standard Library
  3. API Docs
  4. regex
StandardLibrary v2.3.2 published on Tuesday, Feb 10, 2026 by Pulumi
std logo
StandardLibrary v2.3.2 published on Tuesday, Feb 10, 2026 by Pulumi

    Returns the first match of a regular expression in a string (including named or indexed groups).

    Using regex

    Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

    function regex(args: RegexArgs, opts?: InvokeOptions): Promise<RegexResult>
    function regexOutput(args: RegexOutputArgs, opts?: InvokeOptions): Output<RegexResult>
    def regex(pattern: Optional[str] = None,
              string: Optional[str] = None,
              opts: Optional[InvokeOptions] = None) -> RegexResult
    def regex_output(pattern: Optional[pulumi.Input[str]] = None,
              string: Optional[pulumi.Input[str]] = None,
              opts: Optional[InvokeOptions] = None) -> Output[RegexResult]
    func Regex(ctx *Context, args *RegexArgs, opts ...InvokeOption) (*RegexResult, error)
    func RegexOutput(ctx *Context, args *RegexOutputArgs, opts ...InvokeOption) RegexResultOutput

    > Note: This function is named Regex in the Go SDK.

    public static class Regex 
    {
        public static Task<RegexResult> InvokeAsync(RegexArgs args, InvokeOptions? opts = null)
        public static Output<RegexResult> Invoke(RegexInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<RegexResult> regex(RegexArgs args, InvokeOptions options)
    public static Output<RegexResult> regex(RegexArgs args, InvokeOptions options)
    
    fn::invoke:
      function: std:regex
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Pattern string
    String string
    Pattern string
    String string
    pattern String
    string String
    pattern string
    string string
    pattern String
    string String

    regex Result

    The following output properties are available:

    Result object
    Result interface{}
    result Object
    result any
    result Any
    result Any

    Package Details

    Repository
    std pulumi/pulumi-std
    License
    std logo
    StandardLibrary v2.3.2 published on Tuesday, Feb 10, 2026 by Pulumi
      Meet Neo: Your AI Platform Teammate