[Home] [Downloads] [Search] [Help/forum]

Gammon Software Solutions forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  General
. . -> [Subject]  Matching X number of words

Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

Matching X number of words

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page


Posted by Neverwhere   USA  (40 posts)  [Biography] 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.
[Go to top] top

Posted by Nick Gammon   Australia  (18,772 posts)  [Biography] 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
[Go to top] top

Posted by Neverwhere   USA  (40 posts)  [Biography] 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.
[Go to top] top

Posted by Nick Gammon   Australia  (18,772 posts)  [Biography] 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
[Go to top] top

Posted by Neverwhere   USA  (40 posts)  [Biography] 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.
[Go to top] top

Posted by Demonsurfer   USA  (256 posts)  [Biography] 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"

[Go to top] 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]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

[Home]

Written by Nick Gammon - 5K

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( http://www.gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Internet Contents Rating Association (ICRA) - 2K]    [Web site powered by FutureQuest.Net]