Hello Silver,

Historians believe that Tue, 30 Jan 2001 at 21:23 GMT -0800 was when,
Silver Fox [SF] typed the following:

SF> Just wanted to thank you guys!  After three days of reading and a few hours
SF> of trial and error, I set figured out my first Regex, and I _almost_
SF> completely understand it.

That's great.  Congratulations.

<snip>
SF> %SETPATTREGEXP="(?is).*(^.*in the amount of.*?$)"
SF> %REGEXPBLINDMATCH="%TEXT"
SF> %SUBPATT="1"
SF> %SUBPATT="2"

Note the subpatterning here.  Subpatterns are defined by the round
brackets, with the exception of "(?" constructions.  So, count the
number of "(", and that will tell you the subpattern number.  In your
example, you only have one set of round brackets that define a
subpattern.  This is a special case, and for this reason, it is
causing some of your confusion.  See below.

<snip>

SF> I still don't understand entirely what the subpatterns do for me.  I've
SF> learned that replacing %REGEXPBLINDMATCH with %REGEXPMATCH allows me to just
SF> remove %SUBPATT="1" AND %SUBPATT="2"

You only have one subpattern so Subpattern 2 is empty.  You can
remove it from either case and everything will work.

%REGEXPMATCH returns Subpattern 1 if not empty, otherwise it
returns subpattern 0.  Now in your case, the only non-empty
subpatterns are 0 and 1, so you're not seeing the difference.

SF> I've got a couple three ideas of what this could possibly be used for, but I
SF> don't quite get it.

Put this into a test template, and try exploring.  Try to guess what
the output would be when the template is applied in a reply.  Perhaps
it will elucidate the situation.

<template>
%SETPATTREGEXP="^(.*)(@)(.*)$"%REGEXPBLINDMATCH="%OFROMADDR"
%%RegexpBlindMatch gives me:
Subpattern 0: <%Subpatt="0">
           1: <%Subpatt="1">
           2: <%Subpatt="2">
           3: <%Subpatt="3">
           4: <%Subpatt="4">

While %%RegexpMatch gives me:
%SETPATTREGEXP="^(.*)(@)(.*)$"%REGEXPMATCH="%OFROMADDR"
</template>

SF> If this may help focus an answer, this is what the help file says about
SF> them:

SF> %REGEXPBLINDMATCH=�string� is like %REGEXPMATCH=�string� macro except
SF> matched string/substrings are not returned, they may be further extracted by
SF> %SUBPATT="n" macro where n is a number of captured substring; 0 means text
SF> matching entire regexp pattern, 1 - matching first subpattern, 2 - second
SF> subpattern,. etc.... Thus this %REGEXPBLINDMATCH=�string� macro allows more
SF> then one subpatterns e.g.

<snip>

Did I clear up the confusion with this part of the help file?  Or not
yet?

 

-- 
Thanks for writing,
 Januk Aggarwal

 Using The Bat! 1.49c under Windows 98 4.10 Build 2222  A

 Personal Plan:  To avoid sanity, lucidity and wit at all costs.

-- 
______________________________________________________
Archives   : <http://tbtech.thebat.dutaint.com>
Moderators : <mailto:[EMAIL PROTECTED]>
Unsubscribe: <mailto:[EMAIL PROTECTED]>

You are subscribed as : [email protected]


Reply via email to