Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Entire forum
➜ MUSHclient
➜ General
➜ Matching X number of words
Matching X number of words
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Neverwhere
USA (40 posts) Bio
|
Date
| Thu 14 Nov 2002 01:43 AM (UTC) |
Message
| Ok, in the mud I play mobs have various name lengths. I currently have the trigger set for '(\w*) is in bad shape'. That only returns the first word before the set words, and I was wondering if there was a way to match X words before the text and return them all at the same time.
Neverwhere |
ChaosMUD: chaosmud.org:23
Always looking for new players/coders. Willing to train if your willing to lear. Contact Neverwhere or just mention that I sent you. | Top |
|
Posted by
| Nick Gammon
Australia (23,120 posts) Bio
Forum Administrator |
Date
| Reply #1 on Thu 14 Nov 2002 04:18 AM (UTC) |
Message
| Is the only thing likely to be between them spaces? You could just look for a space as well in a "set" (in square brackets), ie.
([\w ]*) is in bad shape
(That is a space after the "w").
Alternatively, since the words "is in bad shape" will define where the name ends, you could just use:
(.+) is in bad shape |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Neverwhere
USA (40 posts) Bio
|
Date
| Reply #2 on Mon 18 Nov 2002 03:02 PM (UTC) |
Message
| Ok...
How do I return all of the words in that (.+) at the same time? Will %1 work?
Neverwhere |
ChaosMUD: chaosmud.org:23
Always looking for new players/coders. Willing to train if your willing to lear. Contact Neverwhere or just mention that I sent you. | Top |
|
Posted by
| Nick Gammon
Australia (23,120 posts) Bio
Forum Administrator |
Date
| Reply #3 on Mon 18 Nov 2002 10:28 PM (UTC) |
Message
| Yes, %1 matches everything inside the first round brackets. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Neverwhere
USA (40 posts) Bio
|
Date
| Reply #4 on Tue 19 Nov 2002 12:52 PM (UTC) |
Message
| thanks man
Neverwhere |
ChaosMUD: chaosmud.org:23
Always looking for new players/coders. Willing to train if your willing to lear. Contact Neverwhere or just mention that I sent you. | Top |
|
Posted by
| Guest1
USA (256 posts) |
Date
| Reply #5 on Tue 19 Nov 2002 02:18 PM (UTC) |
Message
| why not just trigger on
^* is in bad shape
if it's a new line, and send "blah %1 blah"
| Top |
|
The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).
To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.
17,266 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top