[TF] Really stupid pattern matching problem.
Brought to you by:
kenkeys
|
From: johans at stack.nl (J. v. Selst) - 2003-03-06 11:57:46
|
Hi Stefan, Stefan Linnemann wrote: > Given a message like: > 2003/03/06 04:24:09 - Name outguilded Othername. > > and the trigger like: > /def -p0 -mglob -t'[0-9/]* [0-9:]* - [A-Za-z]* outguilded [A-Z][a-z]*.' > sentoust = /echo Sentoust: 1: %1, 2: %2, 3: %3, 4: %4, 5: %5, 6: %6. There are two things wrong with this. With globs "[0-9/]*" matches the first character only (must be 0-9 or /) followed by any other random characters. If you want to match a string entirely consisting of 0-9 or / characters, then you should use -mregexp. %6 matches the sixth word on a line. To match with an expression you should use parentheses "()" and %Pn, for example: /def -p0 -mregexp -t'[0-9/]* [0-9:]* - [A-Za-z]* outguilded ([A-Z][a-z]*).' sentoust = /echo Sentoust: 1: %1, 2: %2, 3: %3, 4: %4, 5: %5, 6: %P1. Ciao, Johan |