Multiline trigger.

Posted by Poromenos on Mon 29 Nov 2004 10:57 AM — 6 posts, 21,225 views.

Greece #0
I am trying to match:
The six sided die rolls out onto the ground and the result is... 1
The six sided die rolls out onto the ground and the result is... 5

Why won't this work?
^The six sided die rolls out onto the ground and the result is\.\.\. (\d)\nThe six sided die rolls out onto the ground and the result is\.\.\. (\d)\z
USA #1
The RegExp parser hates you...

Err, Really... Dont you need the second \n? (before \z)

Edit: Yep, that seems to work for me.
Amended on Mon 29 Nov 2004 03:26 PM by Flannel
Greece #2
Bah, thanks. I never would have guessed, I thought \z would be enough.
Greece #3
By the way, helpfile:
Quote:

A simple example would be to match on:

You are hungry.
You are thirsty.

To match this you might have the regular expression:

Match: ^You are hungry\.\nYou are thirsty\.\z

Doesn't this need to be changed too?
Australia Forum Administrator #4
OK, changed it for the next release.

I remember now why the example is wrong. Initially multi-line triggers put a newline *between* lines but not after the final line. That was when I wrote the example. However that made it hard to match on (line A|line B) both of which might end in a newline. So now there is a final newline, which you have to put in the regexp.

I have reworked the other examples on that help screen as well to make them work.

BTW are your fonts working now?
Amended on Mon 29 Nov 2004 09:01 PM by Nick Gammon
Greece #5
Yes, perfectly. They do require that I open the fonts dialog and click ok for every world then save, but that's not too much of a hassle. I suppose I could use sed to do it on them all at once.