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
aslanthekat
Novice


Joined: 17 Sep 2007
Posts: 44
Location: Missouri

PostPosted: Wed Jul 25, 2012 3:46 pm   

Pattern Matching: Not at beginning of a line
 
Hey all,
Is there a way to make a trigger fire similar to matching at the beginning of a line, but match only if its NOT at the beginning of a line? Same thing for end of line.[/code]
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Wed Jul 25, 2012 4:03 pm   
 
There's no patternmatching construct for it, but you can test for this using %begins() and %ends().
_________________
EDIT: I didn't like my old signature
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Wed Jul 25, 2012 5:34 pm   
 
You could do it with a regex trigger, like so:
Code:
#REGEX {.+YOURPATTERNHERE.+} {YOURCODEHERE}

In a regular expression "." is a wildcard for any character, and "+" means at least one instance of the preceding pattern. So .+ means "at least one character". Putting that before your pattern guarantees that your pattern will not match the start of the line, and similarly for putting it after your pattern.
[edit]Note that if you used wildcards or other expressions in your pattern, you will have to translate those to regular expressions, too. See the help under #REGEX.
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