On Sun, 11 Jul 2010 22:25:42 -0400, rconn <>
wrote:
|---Quote---
|> How am I to interpret the return value of @REGEX[] below? It doesn't
|> seem to be the (documented) "number of matching groups".
|>
|>
|> Code:
|> ---------
|> e:\logs\mercury> echo %@REGEX["(efused)|(uthor)|(known)",refused]
|> 4
|> ---------
|---End Quote---
|I tried that on several regular expression testers, and got results of 0, 1,
|or 4, depending on the RE emulation desired.
|
|So -- what are you trying to do, and what language syntax are you using?
I use PERL syntax. Your return value doesn't seem to depend on how
many are found. Are you returning region.num_regs? That's always the
number of parens (plus 1) in the regex. That's what it looks like
(see below). You have to loop to get all the matches.
Code:
v:\> echo %@regex[(a)|(b)|(c),cat]
4
v:\> echo %@regex[(a)|(b)|(c),ccaat]
4
v:\> echo %@regex[(a)|(b)|(c),cccaaat]
4
v:\> echo %@regex[(a)|(b)|(c)|(d),cccaaat]
5
v:\> echo %@regex[(a)|(b)|(c)|(d),ccaat]
5
v:\> echo %@regex[(a)|(b)|(c)|(d),cat]
5