Replace |
|
Description
Replaces all instances of a specified string with a new string.
Arguments
1.Replace - Name of the Macro.
2.Base String - The base string that will be used for the macro.
3.Search String - A substring that will be used to search the base string.
4.Replace String - A string that will replace any instance where the search string is found.
5.Regex Operation - If set to true the search and replace operation is performed using regular expression which allow for advanced capabilities and capturing groups.
Examples
<Replace|Jim|J|T>
Returns "Tim".
<Replace|This is a test|is|was>
Returns "This was a test".
<Replace|This is a test| is| was>
Returns "This was a test".
<Replace|<Parameter|Superhero>|Bat|Spider>
If the parameter is defined as Batman it returns "Spiderman". If the parameter is defined as something else it returns that value. If the parameter is not defined it returns a blank value.
<Replace|THIS IS A TEST OF THE SYSTEM|a|the>
Returns "THIS IS A TEST OF THE SYSTEM" because the search and replace is case sensitive.
<Replace|<Lower|THIS IS A TEST OF THE SYSTEM>|a|the>
Returns "this is the test of the system".
<Replace|The amount 123.45000 has a lot of digits|(.*\d*\.\d{2})\d*(.*)|$1$2|true>
Returns "The amount 123.45 has a lot of digits".
Notes
The comparison of the search string to the base string is case sensitive. Whitespace is preserved when both searching and replacing the string. If the replacement value is not found the base string is returned unchanged.
Copyright © 2024 pasUNITY, Inc.
Send comments on this topic.
Created with an evaluation copy of HelpSmith.
To remove this notice, you should purchase the full version of the product.