Open topic with navigation

# regex_replace_all

The `regex_replace_all` method searches a string for matches to a regular expression, and replaces the matches according to the value specified by the `replacement` argument.

## Syntax

    regex_replace_all( input, regex, replacement )

## Arguments

Argument | Description
--- | ---
`input` | (string) The string in which you want to replace values.
`regex` | (string) The regular expression to use to find values to be replaced.
`replacement` | (string) A string that specifies how to replace the matches of the regular expression.

## Returns

(String). The modified string.

## Examples

    regex_replace_all("ABC ABC ABC", "AB", "A")
    -- returns "AC AC AC"

    regex_replace_all("One Two Three", "\\w{3}", "_")
    -- returns "_ _ _ee"

    regex_replace_all("One Two Three", "(\\w+) (\\w+)", "\\2 \\1")
    -- returns "Two One Three"

© Copyright 2019 Micro Focus or one of its affiliates | Send documentation feedback Close Send documentation feedback To open the configured email client on this computer, open an email window. Otherwise, copy the information below to a web mail client, and send this email to swpdl.idoldocsfeedback@microfocus.com. We appreciate your feedback! Product: Topic Title: Help Topic: Feedback:

_FT_HTML5_bannerTitle.htm