Multiline trigger question

Posted by Poromenos on Tue 15 Jun 2004 07:04 PM — 4 posts, 16,837 views.

Greece #0
I'm a bit confused at this one. I want to match on:

Exits: north south

<13hp>

but not
Exits: north south
Someone is standing here.

<13hp>

I don't want to use the prompt to match, so I thought I could make a multiline trigger that matches on:
^Exits\: (.*?)\.\n\z
But it matches in both cases. How can I make it match on Exits: * and then an empty line?
Australia Forum Administrator #1
The simple solution is to add the extra newline, like this:


^Exits\: (.*?)\n\n\z


Thus, it looks for 2 newlines (because one blank line consists of 2 consecutive newlines).

A more complex method might be to use a "lookahead assertion" to check that the next line does *not* start with "Someone is standing here.", if that is the only case you want to exclude.
Greece #2
Ahh great, thanks... Why doesn't ^Line1$\n^$ do what I expected though?
Australia Forum Administrator #3
I'm not sure - I had some problems myself with things like ^ and $ in multi-line triggers.

Maybe ^Line1$^$ would work but I wouldn't bet on it.