If Then Else?

Posted by Khamura on Sat 20 Oct 2001 08:49 PM — 3 posts, 14,124 views.

Germany #0
I couldn't seem to find this in any of the help files, so I figured I might as well ask here to either get pointed to where to find the info I need or get it explained. :)

All I'd like to know is how to make the equivalent of "IF THEN ELSE" checks with regular expressions, for usage as both aliases and triggers. Is there a way to do that?
Australia Forum Administrator #1
I'm not sure what you mean by that for a regular expression - it either matches or it doesn't.

However there are a couple of things you can do.

One is to call a script, the script can have if-then-else in it.

The other is to use "or" in a regular expression, eg. match on:


^(Nick|Khamura) pages you.$


That would match on:



Nick pages you.

or

Khamura pages you.

Australia Forum Administrator #2
Another thing you can do is to give the trigger a sequence, thus if you had two triggers:

Sequence 90: Nick pages you.
Sequence 95: * pages you.

Then if you are paged by Nick the first trigger will match, otherwise the second one. This is a form of "else".