Calling a wildcard in an alternate trigger match

Posted by Natasi on Sat 27 Oct 2007 02:32 AM — 5 posts, 23,791 views.

#0
Hey there, I'm having some trouble with this trigger here. I'm trying to match on the left or right, but the %1 calls out the entire line when I have it set up as an alternate type of trigger. Any way I can call that left|right to check for a match?

<triggers>
  <trigger
   enabled="y"
   group="aff"
   keep_evaluating="y"
   match="(^missing the (left|right) ear\.$|^Blood flows into your (left|right) side inner ear\, inhibiting your sense of balance\.$)"
   name="severedear_aff"
   regexp="y"
   repeat="y"
   send_to="12"
   sequence="100"
  >
  <send>if ("%1" = "right") Then
call diagcall ("severed_rightear")
elseif ("%1" = "left") Then
call diagcall ("severed_leftear")
end if</send>
  </trigger>
</triggers>
Russia #1
Change the pattern to:


(?:^missing the (left|right) ear\.$|^Blood flows into your (left|right) side inner ear\, inhibiting your sense of balance\.$)


The first wildcard in your pattern was filled by the outermost capture group, so it always contained the entire matched string. Using "?:" after the opening bracket makes sure that the group isn't captured.

[EDIT]: Actually, make it:


^(?:missing the (left|right) ear\.|Blood flows into your (left|right) side inner ear\, inhibiting your sense of balance\.)$

Amended on Sat 27 Oct 2007 03:05 AM by Ked
Australia Forum Administrator #2
Alternatively, each group (that is, thing in brackets) becomes its own wildcard, so I would have thought the first left/right would be %2, and the second left/right would be %3.
Australia Forum Administrator #3
The other thing is to remove the "outer" brackets - you don't need them, and all that does is make the entire matching line be wildcard %1.
#4
Hmm, I tried removing the brackets and then it wasn't picking up the line at all. Thanks for the ?: suggestion I will try that in my triggers and see how it works.

I actually tried the %2/%3 also and it still didn't pick it up, it would only trigger the whole line as %1. I used note "%1", note "%2", and note "%3" to test this.