Matching X number of words

Posted by Neverwhere on Thu 14 Nov 2002 01:43 AM — 6 posts, 23,363 views.

USA #0
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
Australia Forum Administrator #1
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
USA #2
Ok...

How do I return all of the words in that (.+) at the same time? Will %1 work?

Neverwhere
Australia Forum Administrator #3
Yes, %1 matches everything inside the first round brackets.
USA #4
thanks man

Neverwhere
USA #5
why not just trigger on

^* is in bad shape

if it's a new line, and send "blah %1 blah"