Test if a text matches a regular expression.
Simple test:
/re-test find=/dog/i The quick brown fox jumps over the lazy dog. | /echo
Pipes need to be escaped:
/re-test find=/dog\|cat/i The quick brown fox jumps over the lazy dog. | /echo
Find and replace with regular expressions.
Simple find-replace:
/re-replace find=/dog/i replace=cat The quick brown fox jumps over the lazy dog. | /echo
Use
$1
, $2
, ... to reference capturing groups:/re-replace find="/(\\w+)\\b dog/i" replace="$1 cat" The quick brown fox jumps over the lazy dog. | /echo
Replace matching parts with the result of other slash commands:
/re-replace find="/(fox\|dog)/ig" cmd="/input replace $1 with:" The quick brown fox jumps over the lazy dog. | /echo