kameloso.plugins.sedreplace

The SedReplace plugin imitates the UNIX sed tool, allowing for the replacement/substitution of text. It does not require the tool itself though, and will work on Windows too.

$ echo "foo bar baz" | sed "s/bar/qux/"
foo qux baz

It has no bot commands, as everything is done by scanning messages for signs of s/this/that/ patterns.

It supports a delimiter of /, |, #, @, , _ and ;, but more can be trivially added. See the DelimiterCharacters alias.

You can also end it with a g to set the global flag, to have more than one match substituted.

$ echo "foo bar baz" | sed "s/bar/qux/g"
$ echo "foo bar baz" | sed "s|bar|qux|g"
$ echo "foo bar baz" | sed "s#bar#qux#g"
$ echo "foo bar baz" | sed "s@bar@qux@"
$ echo "foo bar baz" | sed "s bar qux "
$ echo "foo bar baz" | sed "s_bar_qux_"
$ echo "foo bar baz" | sed "s;bar;qux"  // only if relaxSyntax is true

Members

Classes

SedReplacePlugin
class SedReplacePlugin

The SedReplace plugin stores a buffer of the last said line of every user, and if a new message comes in with a sed-replace-like pattern in it, tries to apply it on the original message as a regex-like replace.

See Also

Meta