1. Packages
  2. String
  3. API Docs
  4. regexp
  5. replace
String v1.0.0 published on Friday, Oct 28, 2022 by Pulumi

str.regexp.replace

Explore with Pulumi AI

String v1.0.0 published on Friday, Oct 28, 2022 by Pulumi

A regex based replace on a string.

The underlying regexp engine is the go “regexp” stdlib package. You can see details at for available patterns at https://pkg.go.dev/regexp/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>
Copy
def replace(new: Optional[str] = None,
            old: Optional[str] = None,
            string: Optional[str] = None,
            opts: Optional[InvokeOptions] = None) -> ReplaceResult
def replace_output(new: Optional[pulumi.Input[str]] = None,
            old: Optional[pulumi.Input[str]] = None,
            string: Optional[pulumi.Input[str]] = None,
            opts: Optional[InvokeOptions] = None) -> Output[ReplaceResult]
Copy
func Replace(ctx *Context, args *ReplaceArgs, opts ...InvokeOption) (*ReplaceResult, error)
func ReplaceOutput(ctx *Context, args *ReplaceOutputArgs, opts ...InvokeOption) ReplaceResultOutput
Copy

> 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)
}
Copy
public static CompletableFuture<ReplaceResult> replace(ReplaceArgs args, InvokeOptions options)
public static Output<ReplaceResult> replace(ReplaceArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: str:regexp:replace
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

New This property is required. string

The new string.

Note: Inside repl, "$" signs are interpreted as an Expand, so for instance $1 represents the text of the first submatch.

Old This property is required. string
The regular expression to match against.
String This property is required. string
The string to operate over.
New This property is required. string

The new string.

Note: Inside repl, "$" signs are interpreted as an Expand, so for instance $1 represents the text of the first submatch.

Old This property is required. string
The regular expression to match against.
String This property is required. string
The string to operate over.
new_ This property is required. String

The new string.

Note: Inside repl, "$" signs are interpreted as an Expand, so for instance $1 represents the text of the first submatch.

old This property is required. String
The regular expression to match against.
string This property is required. String
The string to operate over.
new This property is required. string

The new string.

Note: Inside repl, "$" signs are interpreted as an Expand, so for instance $1 represents the text of the first submatch.

old This property is required. string
The regular expression to match against.
string This property is required. string
The string to operate over.
new This property is required. str

The new string.

Note: Inside repl, "$" signs are interpreted as an Expand, so for instance $1 represents the text of the first submatch.

old This property is required. str
The regular expression to match against.
string This property is required. str
The string to operate over.
new This property is required. String

The new string.

Note: Inside repl, "$" signs are interpreted as an Expand, so for instance $1 represents the text of the first submatch.

old This property is required. String
The regular expression to match against.
string This property is required. String
The string to operate over.

replace Result

The following output properties are available:

Result string
The input "string" where each pattern matching "old" is replaced by "new".
Result string
The input "string" where each pattern matching "old" is replaced by "new".
result String
The input "string" where each pattern matching "old" is replaced by "new".
result string
The input "string" where each pattern matching "old" is replaced by "new".
result str
The input "string" where each pattern matching "old" is replaced by "new".
result String
The input "string" where each pattern matching "old" is replaced by "new".

Package Details

Repository
str pulumi/pulumi-str
License
String v1.0.0 published on Friday, Oct 28, 2022 by Pulumi