Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Due to spam on this forum, all posts now need moderator approval.
Entire forum
➜ MUSHclient
➜ General
➜ Triggers: Getting wildcards with unknown number of seperating space
Triggers: Getting wildcards with unknown number of seperating space
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Artel
USA (65 posts) Bio
|
Date
| Mon 06 Mar 2006 04:26 AM (UTC) Amended on Mon 06 Mar 2006 04:32 AM (UTC) by Artel
|
Message
| 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". |
Artel. | Top |
|
Posted by
| David Haley
USA (3,881 posts) Bio
|
Date
| Reply #1 on Mon 06 Mar 2006 04:41 AM (UTC) |
Message
| 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. |
David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone
http://david.the-haleys.org | Top |
|
Posted by
| Nick Gammon
Australia (23,158 posts) Bio
Forum Administrator |
Date
| Reply #2 on Mon 06 Mar 2006 05:03 AM (UTC) |
Message
| |
The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).
To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.
13,838 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top