Little Question

by Unknown

Back to Mechanic's Corner.

Unknown2007-07-14 03:01:57
This is a simple little question, why doesn't this do anything:

Pattern:

Animated branches from the trees above suddenly reach down and clutch (%d)


Value:

#cw {lightblue}
#sub {%1 IS IN THE TREES!!}
Gwylifar2007-07-14 03:08:58
Because (%d) matches a number, but the trees almost never clutch numbers, they clutch people with words for names. Try (%w).
Unknown2007-07-14 03:14:11
Ahhhh, thank you, I thought %d grabbed whatever was there.
Laysus2007-07-14 16:11:46
%d is number, %w is word, %s is spaces, * is anything.
Unknown2007-07-14 17:36:29
Is there a downside to using *?
Unknown2007-07-14 20:15:25
Nevermind, thought it's about regex, not some bastardized version.

Edited.
Gwylifar2007-07-14 21:02:26
QUOTE(Deschain @ Jul 14 2007, 01:36 PM) 425753
Is there a downside to using *?

In theory, it's slower. In practice, in this particular trigger, not really. But it's just good practice to use the most specific pattern that will work. If you're trying to match a word, there's no disadvantage to using the %w pattern, and names are always words.