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
gmueller
Apprentice


Joined: 06 Apr 2004
Posts: 173

PostPosted: Thu Jan 18, 2007 10:18 pm   

regex help
 
ok I would like to capture text from the mud and automatically make triggers out of it, because I'm super lazy and hate typing.

Here is my question:

Given an arbitrary string "abc xyz*.@"
(may contain *.+ or in general any ascii character)
is there a function in zmud that escapes it properly so that it is a propper regex pattern?

EX: #SAY %regexconverter("You *hate* me dont you.")

you would see:
You \*hate\* me dont you\.


I would imagine that if zmud automatically turns zugg #TRIGGERS into #REGEX(internally) that there has to be a function of this caliber, does anyone know what it is called, or how to access it?
Reply with quote
gamma_ray
Magician


Joined: 17 Apr 2005
Posts: 496

PostPosted: Fri Jan 19, 2007 1:28 am   
 
Once you've put it into the trigger dialog (in the settings window), use the "convert" button next to the regex checkbox. There isn't a way that I know of to do it from the command line, however you could probably write a function/alias to do it for you easily enough.

HOWEVER, some things that have been said make me believe that ZMud does not use regex internally--for example, non-regex patterns can be compiled in CMud while regex patterns can NOT be compiled*, meaning that non-regex should be faster.

*This was last I heard, I don't use CMud (operating system woes) so it may no longer be the case. YMMV.
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