Replace a text in Regex mode
|Inserts a |
|Inserts the matched substring.|
|Inserts the portion of the string that precedes the matched substring.|
|Inserts the portion of the string that follows the matched substring.|
How to use the wildcard in replacement string
Let’s say you want to remove extra whitespace that occurs after every text color tags in RPG Maker engine.
Your search string should be:
Note the extra space before “
/g” that space is important, as it represents the extra space that we will remove.
Along with the replacement string :
And the result is:
- There is one group in the regex. Group is encapsulated with brackets “
- Even if the search string is in the form of RegEx, the replacement string is still in plain text.
$1in the replacement string will be replaced by any pattern found in the regex group at the first index position.
Of course you can use
$4 and so on, depending on the number of groups in your regex pattern. The numbers behind
$ mark is the index of your group.
Useful tools & resources
Tool to test & debug your regular expression: