Pete Emerson wrote:

if ACTION1 is a subset of (killed chopped smooshed knifed) etc.etc
and ACTION2 is a subset of (with by for from) etc. etc. (or even better,
is ACTION2 always the word "by" ??) then here is my sample program:

#!/usr/bin/perl -w

use strict;

my $text='^7Kore^7Adam killed BEST I TEST by MOD_MACHINEGUN';
my $action1="killed|chopped|smooshed|knifed";
my $action2="with|by|for|from";
$text=~/^(.*) ($action1) (.*) ($action2) (.*)$/;
print "\$1 --> $1\n";
print "\$2 --> $2\n";
print "\$3 --> $3\n";
print "\$4 --> $4\n";
print "\$5 --> $5\n";

yields these results:

$1 --> ^7Kore^7Adam
$2 --> killed
$3 --> BEST I TEST
$4 --> by
$5 --> MOD_MACHINEGUN

If "by" is always consistent, it's a bit easier, drop it from the regex
altogether: $text=~/^(.*) ($action1) (.*) by (.*)$/;
or if ACTION1 is always "killed" ...
$text=~/^(.*) killed (.*) by (.*)$/;

Pete

If the possible words used is not so predictable, perhaps you could strip the first two words and the last two words off, then whatever is left is your elephant/elephant master.

mk46


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to