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
➜ Lua
➜ Trigger matching problem
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Henry Tanner
Finland (23 posts) Bio
|
Date
| Sat 30 Apr 2011 04:43 AM (UTC) |
Message
| 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 |
I got this! | Top |
|
Posted by
| Twisol
USA (2,257 posts) Bio
|
Date
| Reply #1 on Sat 30 Apr 2011 07:20 AM (UTC) Amended on Sat 30 Apr 2011 07:22 AM (UTC) by Twisol
|
Message
| Hmm...
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+)$ |
'Soludra' on Achaea
Blog: http://jonathan.com/
GitHub: http://github.com/Twisol | Top |
|
Posted by
| Nick Gammon
Australia (23,140 posts) Bio
Forum Administrator |
Date
| Reply #2 on Sat 30 Apr 2011 12:25 PM (UTC) |
Message
|
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. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Henry Tanner
Finland (23 posts) Bio
|
Date
| Reply #3 on Tue 03 May 2011 07:55 PM (UTC) Amended on Tue 03 May 2011 08:00 PM (UTC) by Henry Tanner
|
Message
| 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 |
I got this! | Top |
|
Posted by
| Twisol
USA (2,257 posts) Bio
|
Date
| Reply #4 on Tue 03 May 2011 09:37 PM (UTC) |
Message
| ()'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
|
'Soludra' on Achaea
Blog: http://jonathan.com/
GitHub: http://github.com/Twisol | Top |
|
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.
17,719 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top