Replace
Replace is a form of string manipulation.
Replace is used to replace an occurrence of a text string in another text string with something else. Your language may have options like only replacing the first occurrence or to do a global search and replace of all occurrences.


Original string
Search string
Replacement string
Output

// in JavaScript
<script>
    var s = "Automate Office Work";
    var search = "Office Work";
    var replacement = "Everything!";
    var output = s.replace(search,replacement);
    alert(output); // outputs "Automate Everything!"
</script>
// in PHP
<?
    $s = "Automate Office Work";
    $search = "Office Work";
    $replacement = "Everything!";
    $output = str_replace($search,$replacement,$s);
    echo $output // outputs "Automate Everything!"
?>
// in Microsoft Power Automate's Expression panel
replace("Automate Office Work","Office Work","Everything!")
If you want to remove a certain string you could set your replacement string to be empty to effectively remove the search string.
For much more advanced replacement, you can use regular expressions.
Comments
You must sign in to comment
We use cookies to help run our website and provide you with the best experience. See our cookie policy for further details.