|
Matching X number of words
|
Reply to this subject
Start a new subject
 
Refresh page
| Posted by |
Neverwhere
USA (40 posts) bio
|
| Date |
Thu 14 Nov 2002 01:43 AM (UTC) [ quote
] |
| 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 (18,772 posts) bio
Forum Administrator |
| Date |
Reply #1 on Thu 14 Nov 2002 04:18 AM (UTC) [ quote
] |
| 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) [ quote
] |
| 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 (18,772 posts) bio
Forum Administrator |
| Date |
Reply #3 on Mon 18 Nov 2002 10:28 PM (UTC) [ quote
] |
| 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) [ quote
] |
| 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 |
Demonsurfer
USA (256 posts) bio
|
| Date |
Reply #5 on Tue 19 Nov 2002 02:18 PM (UTC) [ quote
] |
| 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.
2,219 views.
Reply to this subject
Start a new subject
 
Refresh page
top
Comments to:
Gammon Software support
Forum RSS feed ( http://www.gammon.com.au/rss/forum.xml )