- May
- 382
- 2
It seems that @REGEXSUB handles regex alternatives incorrectly.
For comparison, @REGEXINDEX matches the second capture in the second line, (b+), while @REGEXSUB doesn't.
Code:
C:\> for %i in (a b c) echo %i in (a+)^|(b+): %@REGEXINDEX["(a+)|(b+)",x%i] (%@REGEXSUB[1,"(a+)|(b+)",x%i])
a in (a+)|(b+): 1 (a)
b in (a+)|(b+): 1 () <=== should match "b"
c in (a+)|(b+): -1 ()
C:\> ver
TCC 9.02.152 Windows XP [Version 5.1.2600]