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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
ReedN
Wizard


Joined: 04 Jan 2006
Posts: 1279
Location: Portland, Oregon

PostPosted: Thu Mar 27, 2008 3:14 pm   

Ansi Triggers in Cmud
 
Well, doing an ansi trigger just got a lot harder in Cmud since I now can no longer hit the convert button to convert all the codes over to a regular expression. I took my best stab at an expression in the native Cmud pattern matching and was looking for a little advice on making it better.

My Pattern:

{%e[37m*|}%e[36m(*)%e[37m*%s(%d)%s({On|Off})%s(%w)%e[0m$

Essentially this is to match on a line that has some coloring (the actual name is code 37) that looks like this:

Mr Name Lastname Othernames 2 On Serpent

In regular expressions, this would be:

^(?:code37\D+)?code36(\D+)code37\D*\s+(\d)\s+(On|Off)\s+(\w+)code0$

I guess I could either figure out what the regex codes would be translated into --- and I'm not sure how to do that. Or I can improve the cmud trigger so that it works better. It kind of works now, but I'm unable to anchor it with ^ without it stopping working. I'm not really sure how to do some of the finer points of regex features in the native cmud trigger language.
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Thu Mar 27, 2008 4:13 pm   
 
The regex equivalent of %e is \033. Also, just so you know, wildcards like %e don't work in the {pattern|pattern} syntax.

EDIT: I must've misunderstood your question, because as far as I can tell this is no different to the other thread. Can you explain a bit better?
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD 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