Hello Alinda,

On Thursday, September 19, 2002 at 04:17 GMT +0200, earthworms were
entertained when Alinda Helleman [AH] exposed:

AH> I thought the following QT should do the trick.

AH> ,------- [ QT wrappedcookie ] -------
AH> | %SETPATTREGEXP="^(.*)-/-(.*)$"%-
AH> | %REGEXPBLINDMATCH="%QINCLUDE='pickcookie'"%-
AH> | %WRAPPED="%SUBPATT='1'"
AH> | %SUBPATT="2"%-
AH> `------------------------------------

The problem you're noticing is not a bug, it is due to how the macros
are processed.  The argument to a macro can be thought of as a
mini-template, and regular expressions are not inherited from a parent
template.  What do I mean?

Well, you defined your regular expression at the QT level, but you're
calling %SUBPATT="1" inside the mini-template of %WRAPPED.  But you
didn't define a regular expression in the mini-template, so the
subpattern is empty.

To get around the issue, you need to define the regular expression
in both places.  But you are using a QT to randomly choose your
cookie, so you should use the %COMMENT field to store the result of
your picking the cookie.  The template would look something like:

=====[Begin wrappedcookie]=====
%COMMENT="%QINCLUDE='pickcookie'"%-
%-
%WRAPPED='%-
%SETPATTREGEXP="^(.*)-/-(.*)$"%-
%REGEXPBLINDMATCH="%COMMENT"%-
%SUBPATT="1"'
%-
%SETPATTREGEXP="^(.*)-/-(.*)$"%-
%REGEXPBLINDMATCH="%COMMENT"%-
%SUBPATT="2"
%-
%COMMENT=""%-
=====[ End  wrappedcookie]=====

-- 
Thanks for writing,
 Januk Aggarwal

All science is either physics or stamp collecting.
-- E. Rutherford


________________________________________________________
 Current version is 1.61 | "Using TBTECH" information:
http://www.silverstones.com/thebat/TBUDLInfo.html

Reply via email to