|
cachew Novice
Joined: 10 May 2001 Posts: 39 Location: USA
|
Posted: Wed Apr 23, 2008 4:30 pm
Matching and exact # of spaces |
How do you you match an exact number of spaces in a trigger?
Example:
between var1 and var2 I would like to match, in a trigger, exactly 2 spaces and between var2 and var3 I would like to match exactly 4 spaces.
I have tried various permutations of &nn %w etc and I can't seem to get it.
thanks |
|
_________________ Christopher Chew |
|
|
|
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Wed Apr 23, 2008 4:59 pm |
Maybe I'm missing something here. To match an exact number of spaces, simply include the spaces in your trigger:
Code: |
#trigger {var1 var2 var3} {#say success!}
#show {var1 var2 var3}
|
success!
hm. I thought quoting would retain the spaces. oh well. Try the above with the actual spacing you want. |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Wed Apr 23, 2008 5:29 pm |
I edited both your messages to use the all-important code tag. Please try to remember, 007.
Anyway, Rahab's exactly right. Just put the spaces in and it'll match. Similarly, if you put too many spaces in, it'll stop a pattern from matching. |
|
|
|
meyn Beginner
Joined: 06 Mar 2008 Posts: 27
|
Posted: Wed Apr 23, 2008 5:41 pm |
In my mud i had the following trigger
#TR {(%w) is dead~! R~.I~.P~.} {}
there are 2 spaces before the R.I.P but zmud kept changing my trigger to only have 1 space, to get around this:
#TR {(%w) is dead~!(%s)R~.I~.P~.} {}
the (%s) matches anynumber of spaces, if you change your trigger to:
#TR {var1(%s)var2(%s)var3}
the pattern will now match all spaces
hope this helps |
|
|
|
|
|