|
Scarn Apprentice
Joined: 24 Jul 2005 Posts: 137
|
Posted: Mon Feb 24, 2014 11:42 am
Pattern matching. |
I've come into a problem, I have the following pattern that I want to get variables from:
&Name the &Race (*)
It will fire on for example:
Scarn the edain Bear-Spirit
However it also fires on any sentence with "the" as the second word. In an ideal situation I
would something like
&Name the {edain|elven|dwarven}(*)
This would allow it to only fire on the text I need it to, but if I am using "match pattern", how
do I save it to the Race variable? |
|
|
|
Scarn Apprentice
Joined: 24 Jul 2005 Posts: 137
|
Posted: Mon Feb 24, 2014 4:24 pm |
Apparently I have been getting patterns wrong all this time, I've sorted it using the following method:
Code: |
^%w the ({edain|elven|dwarven})(*) |
I then use the following to capture the variables and achieve the aim!
Code: |
name = %1
race = %3
|
|
|
|
|
|
|