|
deathkitty Apprentice
Joined: 14 Apr 2008 Posts: 105
|
Posted: Wed Apr 30, 2008 12:32 pm
using wildcards in multiple pattern matching? |
I also have another slightly-related question:
how do i use a * in a trigger pattern with multiple options? * doesn't seem to work when it's inside {}s
here is an example of what it is like at the moment:
{a fat soldier|an ugly soldier|a smart soldier|a mean soldier}
so you can see what I am trying to do
I want to capture the whole phrase "a whatever soldier", and i want to expand this to have a list of second words too so i can do not just soldiers
not sure what to do really at all
this is completely wrong syntax im sure but again this is the kind of thing i am trying to do so gives you an idea
pattern
({a|an} * {soldier|giant spider|mugger|priest})
captured:
an ugly soldier
a vicious giant spider
a scary mugger
an angry priest
etc
(then I do #cw red) |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Wed Apr 30, 2008 1:51 pm |
In short: You can't.
In slightly longer: Use a regex instead.
You could actually just do it the way you have in your trigger there if you like, but a regex will probably neater.
Also, you probably shouldn't be using * unless you really mean "any character". In your examples there, you mean "a word", so you should use %w. |
|
|
|
|
|