Wildcards not pulling correctly.

Posted by Sleaker on Sat 21 Sep 2002 04:04 AM — 5 posts, 20,984 views.

#0
Okay I have a trigger:
^[A-Za-z *]*\[(?:.*?)\](?:.*?) x:(?:.*?) y:(?:.*?) z:(?:.*?) r:(.*?) b:(.*?) s:(.*?) h:(.*?) S:(.*?)

you remember this don't you YEAH!
Sample of what it's trying to parse:
PS*[ps]B Alpha Mongoo x: 5 y: 5 z: 0 r: 3.3 b:298 s: 0.0 h: 0 S: S

okay,

When the script runs:

Sub Store_Contact2(thename, theoutput, theparameter)
'Inputs: Contact information from contacts last 5 items.
'Outputs: None.
'Purpose: Store contact data on target for later use.
strRange = World.GetVariable("SecContactColor") & "Range: " & World.GetVariable("PriContactColor") & Trim(theparameter(1))
strSpeed = World.GetVariable("SecContactColor") & "Speed: " & World.GetVariable("PriContactColor") & Trim(theparameter(3))
strHead = World.GetVariable("SecContactColor") & "Head: " & World.GetVariable("PriContactColor") & Trim(theparameter(4))
strStatus = World.GetVariable("SecContactColor") & "Status: " & World.GetVariable("PriContactColor") & Trim(theparameter(5))
StoreContact
End Sub

It just inputs blank values instead of
str = this stuff
so when I try using the info I am using all blank values except for the World.GetVarables.
so the Trim(theparameter(#))s are returning blanks..

Now my first question is, is the trigger correct and then why is it giving blanks back yet the script is still being run..
Australia Forum Administrator #1
Seems to me you need to "escape" the asterisk, otherwise it is looking for multiple spaces, not a space or an asterisk. I got this to work, I usually try displaying the wildcards first (see example below) and then work on the script.


<triggers>
  <trigger
   custom_colour="2"
   enabled="y"
   match="^[A-Za-z \*]*\[(?:.*?)\](?:.*?) x:(?:.*?) y:(?:.*?) z:(?:.*?) r:(.*?) b:(.*?) s:(.*?) h:(.*?) S:(.*?)$"
   regexp="y"
   send_to="2"
   sequence="100"
  >
  <send>w 1 = %1
w 2 = %2
w 3 = %3
w 4 = %3
w 5 = %5</send>
  </trigger>
</triggers>
#2
ahh for some reason it liked started working when I put another A-Z inside the first []
Canada #3

^[A-Za-z \*]*\[(?:.*?)\](?:.*?) x:(?:.*?) y:(?:.*?) z:(?:.*?) r:(.*?) b:(.*?) s:(.*?) h:(.*?) S:(.*?)$
    ^
    ^
   I think this will be wildcard 1, if I understand that right.

You may want to add more escape characters:

^[A-Za-z \*]*\[(?:.*?)\](?:.*?) x\:(?:.*?) y\:(?:.*?) z\:(?:.*?) r\:(.*?) b\:(.*?) s\:(.*?) h\:(.*?) S\:(.*?)$

...but if you have it working, you may not want to play with it any more.
Amended on Sat 21 Sep 2002 04:48 PM by Magnum
Australia Forum Administrator #4
Quote:

I think this will be wildcard 1, if I understand that right.


No, because it is not in round brackets.