|
yorcadon Beginner
Joined: 11 Jun 2009 Posts: 16
|
Posted: Thu Jun 11, 2009 10:16 pm
Splitting the trigger pattern abnormally |
So here is the best way I can think of to explain what I want to do.
"This is an example paragraph. I want it split and saved into two variables. Lets call the first variable Var1 and the second variable Var2."
So for the pattern lets say I had something like
The way it would save it is by splitting at the last period found. So every sentence except the last one would be placed into Var1.
I want to do the opposite. I want Var1 to only have the first sentence, and Var2 to have the rest of the paragraph. Any way to do this?
The paragraphs will always be different and could contain any number of sentences (my example assumes they'll always end in a period) |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Thu Jun 11, 2009 11:15 pm |
Use a regex. Regexes can do anything :P See also.
Anyway, you want something like
^(.+)\. (.+)\.$"
Because the first + is greedy, it should capture everything except the last sentence. |
|
|
|
yorcadon Beginner
Joined: 11 Jun 2009 Posts: 16
|
Posted: Fri Jun 12, 2009 10:16 am |
So how would that translate into this
^~(chatname~) Person wisps: Q%d. &Var1. &Var2
Thanks in advance. Apparently I don't know much about regex. I'll do some reading. |
|
|
|
Tech GURU
Joined: 18 Oct 2000 Posts: 2733 Location: Atlanta, USA
|
Posted: Fri Jun 12, 2009 1:56 pm |
This should do what you want.
Code: |
^\(chatname\) Person wisps: Q\d+\. (?Var1:.+)\. (?Var2:.+)\.$ |
The easiest way to is to click the Convert butter when you edit your trigger. It will automatically translate a zMud trigger pattern to a a regex. |
|
_________________ Asati di tempari! |
|
|
|
|
|