Filters

The KSirc Handbook
Prev |  | Next

# Chapter 3. Filters

# 3.1. Filter Rules and How to Make them

If just you just can't figure it out, wait. I want to build a nice "filter builder" where you can just click your way through it. Though, it might be a while.

The filter tries to find the "match" string then use the "From" and "To" as a substitution. You could do both operations simply with the substation this allows finer control on which strings you do the substitution. The match, from, and to are all perl regex expressions. Rules are evaluated in descending order. The top rule is first evaluated, then the second from the top, etc. All strings are evaluated as:

$<name> is expanded to the environment variable <name>. This is done immediately when you insert the rule, and will not change after that time. Therefor it's probably of limited value.

$$<name> is substituted with the perl $<name> variable during the match. This can be substrings such as $1, $2 in the substitution, or normal variables available under sirc (such as $nick, $channel, etc).

˜<name>˜ PREPENDED ONCE AND ONLY ONCE to the line will send the line of text to the window called <name>. If the window does not exist it will go to the last window which had focus. There are several special windows, all prefixed by a single "!":

!default

  the current default window. Guaranteed to be.

!all

  Send to every window. This might not show up on all windows, depending on how the parse the text. For example, channel windows won't show a part/quit unless the nick is on the channel.

!discard

  discards the text.

The rest of the expression is dealt with as normal perl regex. A good understanding of the perlre man page will certainly help, but a basic understating of regex is most certainly required.

Prev | Home | Next
Examples |  | Examples: