Hello Januk,

Wednesday, January 31, 2001, 12:47:23 AM, you wrote:

JA> Hello Silver,

JA> Historians believe that Tue, 30 Jan 2001 at 21:23 GMT -0800 was when,
JA> 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.

JA> That's great.  Congratulations.

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

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

JA> <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"

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

JA> %REGEXPMATCH returns Subpattern 1 if not empty, otherwise it
JA> returns subpattern 0.  Now in your case, the only non-empty
JA> 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.

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

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

JA> While %%RegexpMatch gives me:
JA> %SETPATTREGEXP="^(.*)(@)(.*)$"%REGEXPMATCH="%OFROMADDR"
JA> </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.

JA> <snip>

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

 


Yup.  The brackets defines each "subpattern"  (a variable that stores
a string) and using %SUBPATT="n" later in the template will insert the
string at that point.  Since my original template had the regex
followed by the subpatt immediately, I did not realize that subpatt
was returning something.  I was under the impression that one of the
%REGEXP's were.

Clear as a bell now.  Thanx, this will help a lot.

-- 
Best regards,
 Silver                            mailto:[EMAIL PROTECTED]

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

You are subscribed as : [email protected]


Reply via email to