Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
Bajed
Novice


Joined: 15 Aug 2004
Posts: 33

PostPosted: Wed Jan 04, 2006 12:47 am   

Perl Regular Expression + Ansi Trigger
 
Is it possible to use both of these at the same time? My trigger doesn't seem to be firing at all, here is the pattern:

\e[1;32m\((?:Channel1|Channel2)\): (@MyFriends) says, ".+\."

this should fire whenever I get a line like this:

(Channel1): John says, "Hey there Bajed!" and is in green. The trigger isn't working though! Any ideas?
Reply with quote
Bajed
Novice


Joined: 15 Aug 2004
Posts: 33

PostPosted: Wed Jan 04, 2006 12:50 am   
 
Err, I used an exclamation point at the end of my example, but it doesnt work with a period either :P
Reply with quote
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: Wed Jan 04, 2006 2:06 am   
 
No zMud active but your ?: syntax doesn't appear to be correct.
Reply with quote
Bajed
Novice


Joined: 15 Aug 2004
Posts: 33

PostPosted: Wed Jan 04, 2006 2:10 am   
 
It works fine without the ansi stuff, and with the Ansi Trigger option unchecked, heh. (?:...) in regex means to group the contents, but don't capture. which is what I want.
Reply with quote
gamma_ray
Magician


Joined: 17 Apr 2005
Posts: 496

PostPosted: Wed Jan 04, 2006 5:20 am   
 
The problem is that regex uses a different format to match ANSI.

The best way I can explain it is for you to create a trigger and tick ANSI colour but -don't- select regex, then highlight an example line in the MUD of what you want to match, paste it into your trigger, and click the "convert" button. That will convert all of the colours to the proper format and you can then fix your pattern to match the correct text.
Reply with quote
Bajed
Novice


Joined: 15 Aug 2004
Posts: 33

PostPosted: Wed Jan 04, 2006 5:25 am   
 
Ah ok, that works, weird format...

Anyway, this leads me to another questin. It seems I can't use ansi codes in an (?:....), is this true? For example, Channel1 is yellow and Channel2 is blue. I tried doing this in both a normal trigger and its equivalent (now that I know) regex, but neither work:

^\((?:%e[30mChannel1|%e[31mChannel2)\) but it doesnt seem to match either "%e[30mChannel1" or "%e[31mChannel2" ... do the ansi sequences HAVE to come at the very beginning of the trigger? Hrm
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net