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


Joined: 05 Apr 2008
Posts: 121

PostPosted: Tue Jun 24, 2008 5:53 pm   

Help with regex :(
 
one of these days i'll learn this.. but i cant seem to get this to work right:(
I have a capture script I want it to fire on this line
Code:
24 Jun 13:48 - xxx tells you 'that was crazy'

(timestamp)
and also this line
Code:
xxx tells you 'that was crazy'
(no stamp)
what i have now is 2 triggers, one for each.
I'm trying to make my triggers better and more efficient..
Reply with quote
Fang Xianfu
GURU


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

PostPosted: Tue Jun 24, 2008 5:55 pm   
 
Don't anchor. Simply using %w tells you '*' will match both lines, because the first line's match starts later.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
harley
Apprentice


Joined: 05 Apr 2008
Posts: 121

PostPosted: Tue Jun 24, 2008 9:46 pm   
 
Thanks, only problem is if someone quotes another tell, it comes up in capture.
Though not a big problem.. I'll work it out
Reply with quote
Toxic
Adept


Joined: 27 May 2008
Posts: 299

PostPosted: Tue Jun 24, 2008 9:51 pm   
 
#TR {^{%d %w * - |}%w tells you '*'}

This will/should trigger off both lines and also force them to be at the start of a new line
Reply with quote
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: Tue Jun 24, 2008 9:54 pm   
 
EDIT: Ninja'd by zscript. :P

#REGEX {^(?:\d+ \w+ \d+:\d+ - )?\w+ tells you '.*'} {#capture whatever}

That should do it for you.

Charneus
Reply with quote
harley
Apprentice


Joined: 05 Apr 2008
Posts: 121

PostPosted: Tue Jun 24, 2008 10:05 pm   
 
This works
but instead of #capture i use #win
I might have to change to #capture as what charn posted it only does the last letter in the persons name

figured it out with the convert to regex option :P thanks for the help guys
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