1. Packages
  2. Standard Library
  3. API Docs
  4. replace
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

    Does a search and replace on the given string. All instances of search are replaced with the value of replace. If search is wrapped in forward slashes, it is treated as a regular expression. If using a regular expression, replace can reference subcaptures in the regular expression by using $n where n is the index or name of the subcapture. If using a regular expression, the syntax conforms to the re2 regular expression syntax.

    Using replace

    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 replace(args: ReplaceArgs, opts?: InvokeOptions): Promise<ReplaceResult>
    function replaceOutput(args: ReplaceOutputArgs, opts?: InvokeOptions): Output<ReplaceResult>
    def replace(replace: Optional[str] = None,
                search: Optional[str] = None,
                text: Optional[str] = None,
                opts: Optional[InvokeOptions] = None) -> ReplaceResult
    def replace_output(replace: Optional[pulumi.Input[str]] = None,
                search: Optional[pulumi.Input[str]] = None,
                text: Optional[pulumi.Input[str]] = None,
                opts: Optional[InvokeOptions] = None) -> Output[ReplaceResult]
    func Replace(ctx *Context, args *ReplaceArgs, opts ...InvokeOption) (*ReplaceResult, error)
    func ReplaceOutput(ctx *Context, args *ReplaceOutputArgs, opts ...InvokeOption) ReplaceResultOutput

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

    public static class Replace 
    {
        public static Task<ReplaceResult> InvokeAsync(ReplaceArgs args, InvokeOptions? opts = null)
        public static Output<ReplaceResult> Invoke(ReplaceInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<ReplaceResult> replace(ReplaceArgs args, InvokeOptions options)
    public static Output<ReplaceResult> replace(ReplaceArgs args, InvokeOptions options)
    
    fn::invoke:
      function: std:replace
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Replace string
    Search string
    Text string
    Replace string
    Search string
    Text string
    replace String
    search String
    text String
    replace string
    search string
    text string
    replace str
    search str
    text str
    replace String
    search String
    text String

    replace Result

    The following output properties are available:

    Result string
    Result string
    result String
    result string
    result str
    result String

    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