Trigger matching problem

Posted by Henry Tanner on Sat 30 Apr 2011 04:43 AM — 5 posts, 22,606 views.

Finland #0
I have a trigger match line set up as "^*\s\s*\s\s*\s\s\d$" without quotes and for some reason it's not picking up what I'm trying to pick up with it:
Coruscant       Coruscant Sector      The Galactic Republic     100.0
Kashyyyk        Mytaranor Sector      Neutral Government        100.0
Lorrd           Kanz Sector           The Galactic Republic     100.0
Corellia        Corellian System      The Galactic Republic     100.0
Korriban        Horuset System        The Sith Empire           100.0
Tatooine        Tatoo System          The Sith Empire           100.0
Wroona          Wroona System         Neutral Government        100.0
Arkania         Perave System         The Sith Empire           100.0
Ryloth          Ryloth System         The Sith Empire           100.0
Dantooine       Raioballo Sector      Neutral Government        100.0
Alderaan        Alderaan System       The Galactic Republic     100.0
Nal Hutta       Hutt Space            Neutral Government        3.0
Ziost           Ziost System          Neutral Government        100.0


I can't see where I'm doing it wrong
USA #1
Hmm...
^*\s\s*\s\s*\s\s\d$

This literally means "Zero or more start-of-string positions, a space, zero or more spaces, a space, zero or more spaces, a space, another space, and a digit, followed by the end-of-string position. In other words, you're matching a string with at least four spaces plus a single digit. That's not what you want.

The problem is that you're mixing the non-regex pattern's * capture into a regular expression, where * mean's a totally different thing ("zero or more"). What you really want is this:

^[A-Za-z]+\s+[A-Za-z ]+\s+[A-Za-z ]+\s+(\d+\.\d+)$


This is a lot more verbose (clearly), but it should match the example lines given. I had to use (\d+\.\d+) to match the number at the end, because \d only matches a digit (0 through 9).

[EDIT]: Alternatively, if you can be certain that this trigger will only be active when these lines are being processed, you can use the far simpler (\d+\.\d+)$
Amended on Sat 30 Apr 2011 07:22 AM by Twisol
Australia Forum Administrator #2
Henry Tanner said:

I have a trigger match line set up as "^*\s\s*\s\s*\s\s\d$" without quotes and for some reason it's not picking up what I'm trying to pick up with it:


You don't have that, because it is not a valid regular expression, it won't accept it:


Nothing to repeat.

^*\s\s*\s\s*\s\s\d$
^

Error occurred at column 2.


So maybe you don't have regular expressions ticked? In which case that explains a lot.
Finland #3
Twisol's match line works but I'll need to pull the information in to variables:
 Planet          Starsystem            Governed By               Popular Support
Coruscant       Coruscant Sector      The Galactic Republic     100.0 


I need to get the planet, starsystem, governed and popular support.

also there's a line in the beginning of the output and in the end of the output that I can use to enable and disable the trigger...

so how can I get it to work with wildcards?

EDIT: that came out very confusing, so I'm trying to get everything from under the different columns to (after running them through a string.gsub to kill spaces) tables
Amended on Tue 03 May 2011 08:00 PM by Henry Tanner
USA #4
()'s around what you want to capture:
^([A-Za-z]+)\s+([A-Za-z ]+)\s+([A-Za-z ]+)\s+(\d+\.\d+)$


As for the begin/end lines, I'm guessing they're pretty much static, so you can use a non-regex trigger and paste the whole line in.
Planet          Starsystem            Governed By               Popular Support