Regular Expression | Replacement Expression | Result |
{Windows}{ 9[58]} | \1 2000 | Replaces an occurrence of “Windows 95” or “Windows 98” with “Windows 2000”. The “\1” in the replacement expression puts the sub-expression #1, “{Windows}”, into the replacement text and adds the literal “ 2000”. The “95” or “98” in the found text is discarded in the replacement text.
|
{Windows}{ 9[58]} | Wash\2 \1 | Replaces “Windows 95” with “Wash 95 Windows”. Replaces “Windows 98” with “Wash 98 Windows”. The “\2” refers to the found text that matches the second sub-expression, “{ 9[58]}”.
|
{his}{.+}{[kl]eg} | \1\2peg | Replaces “his wooden keg” or “his wooden leg” with “his wooden peg”. |