Triggers: Getting wildcards with unknown number of seperating space

Posted by Artel on Mon 06 Mar 2006 04:26 AM — 3 posts, 17,151 views.

USA #0
I'm trying to make a trigger that will grab the numbers individually from the line below:


               Str   Int   Wis   Dex   Con   Luck   Total
-------------  ----  ----  ----  ----  ----  -----  -----
Natural       : 171   132    77   134    76     98    688
...


The problem is that there is a variable amount of spaces between each number depending if it is a one, two, three, or four digit number. My trigger looks like this:


^Natural       \: (.*?)  (.*?)  (.*?)  (.*?)  (.*?)  (.*?)  (.*?)$"


Each (.*?) will either pick up a whole number or a single space. I have no idea why it would be useful to pick up a single space in a wildcard anyways....but is there a way to make a "smart" trigger that would only pick up the numbers regardless of the number of spaces?

EDIT:
To clarify: The values that it is currently picking up are "171", " 132", "", "77", " 134", and "". But it SHOULD be "171", "132", "77", 134", "76", and "98".
Amended on Mon 06 Mar 2006 04:32 AM by Artel
USA #1
Try:

^Natural       \: (\d*?)[ ]+(\d*?)[ ]+(\d*?)[ ]+(\d*?)[ ]+(\d*?)[ ]+(\d*?)[ ]+(\d*?)$
You shouldn't need the brackets, but they're there just to show exactly what's going on.

Basically, you say: (\d*?) (= some number of digits) followed by at least one space.
Australia Forum Administrator #2
Read this for more information about regexps:

http://www.gammon.com.au/forum/bbshowpost.php?bbsubject_id=5089