Page 1 of 1

Testing trigger patterns

Posted: Wed May 20, 2009 3:01 pm
by Vadi
Firefox was kind enough to crash and lost my first post, so this one is short. How about having an input box for the line(s) you'd like to test against, and another one that displays results? How Kiki does it:

http://www.ubuntu-pics.de/bild/14696/sc ... brTU21.png
http://www.ubuntu-pics.de/bild/14697/sc ... oOM3a2.png

Re: Testing trigger patterns

Posted: Wed May 20, 2009 3:46 pm
by Caled
Having this built in could be handy, I guess. I use
http://www.regexpal.com/
at the moment, so its not a major thing for me. Before I found a link to that site though, I was using the one built into CMUD, which I quite like because it displays the values of the capture groups as well. If you do go to the effort of building one into mudlet, that is a feature I suggest.

Re: Testing trigger patterns

Posted: Wed May 20, 2009 8:04 pm
by Everest
Hmm, I like this. A lot.

One thing I'd like is, if a trigger doesn't match, an easy way to find out which variable is causing it to not match. Kiki seems to do a great job of telling you which variable is which, but maybe I'd like an option to match word by word and see where in the output ("Matches" tab) it stops.

For example, if you messed up with the his/her part of your example, it would output:

0: (Taraza) takes some salve from a vial and rubs it on

This way you could see exactly where the error is.

But then again, maybe you're thinking of implementing a "code checker" that would flag the error once you stopped typing the regex. Like spell check for code.

Re: Testing trigger patterns

Posted: Wed May 20, 2009 9:09 pm
by Vadi
I see what you mean, but that wouldn't be helpful in the case of regexes. They can be very complex and the engine itself is complicated too - I don't think anyone ever came up with such a thing.

Re: Testing trigger patterns

Posted: Sat May 23, 2009 12:42 am
by Everest
Well then I think what you've suggested is an excellent start. It's easy to find the variables, and handles testing multi-line triggers really easily. Although it sounds like Caled would like a list of variables and their contents instead of the way Kiki shows you? Personally I think Kiki's way is much more efficient; you don't need a list, you can just look at what's in the parenthesis.

Re: Testing trigger patterns

Posted: Sat May 23, 2009 2:54 am
by Caled
The way Kiki does it is fine, I was just saying that its the only thing
http://www.regexpal.com/
doesn't seem to have.

Edit:
I wouldn't mind an example of how Kiki displays something like this though:

^go(d)?(s|g)?(\s([A-Za-z' ]*))?$

go
gos
godg
go ollin
godg severn shrine kelsys

The bit I'm interested in, is the capture group inside the capture group, and how it will display the difference between the two (3rd and 4th matches in this case).

Re: Testing trigger patterns

Posted: Sat May 23, 2009 3:09 am
by Vadi
It's Python, so probably regex-implementation specific.

Re: Testing trigger patterns

Posted: Sat May 23, 2009 12:11 pm
by Vadi
Added kiki's help files here: http://drop.io/mudlet1 I think it runs on Windows too.