 |
Vulcaned Newbie
Joined: 02 Jun 2008 Posts: 2
|
Posted: Mon Jun 02, 2008 8:20 pm
Quick help with a task... |
Hey! So I need to trim a single phrase out of a line of text, but can't seem to do it...
The text is formatted like this:
| Code: |
Level 89 : Text 135 83% 451
Level 100 : Text 89 15% 139 |
I've tried a trigger for {Level %1 : %2 %d*}
And then %trim(%2) to get the text (a spell name)
But it doesn't seem to work. When I try to #show %trim(%2) it just gives me:
Text 135 83%
Any suggestions?
-V |
|
|
|
 |
Fang Xianfu GURU

Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Mon Jun 02, 2008 9:06 pm |
I added the code tag to your post to preserve the spacing.
#trig {Level (%d)%s: ([%w ])%s(%d)%s(%d)~%%s(%d)} {#show %1 - %2 - %3 - %4 - %5}
Will match properly. See also this help file. This example assumes certain things about the text (namely, that it only contains alpha characters and spaces). You can add any other characters you need to match to the [%w ] range. |
|
|
|
 |
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Mon Jun 02, 2008 10:48 pm |
To better help you understand why you had a problem, here are two technical explanations about the trigger parser:
1)%1...%99 equate to the * wildcard.
2)the parser always goes with the broadest match it can find.
Given those two things, your pattern (Level %1 : %2 %d*) can be rewritten as this pattern (Level * : * %d*) and the helpfile Fang connected you to should be able to explain why your %2 ended up being "Text 135 83%" instead of just "Text" as you expected. |
|
_________________ EDIT: I didn't like my old signature |
|
|
 |
Vulcaned Newbie
Joined: 02 Jun 2008 Posts: 2
|
Posted: Tue Jun 03, 2008 8:34 pm |
Wow! Thanks for the quick reply and the very detailed explanation :)
|
|
|
|
 |
|
|
|