
RegExp object, matches collection, and sub-patterns
My recollection is that this a known problem that is fixed in the version 5.5 beta. The VBScript
RegExp object has been significantly enhanced.
--
Michael Harris
MVP Scripting
The language reference for VBScript 5 says, under the Pattern property of
the RegExp object:
(pattern) Matches pattern and remembers the match. The matched substring
can be retrieved from the resulting Matches collection, using Item
[0]...[n]. To match parentheses characters ( ), use "\(" or "\)".
Except, no where else is this mentioned and I can't get it to work. The
matches collection seems to have only one match that is for the whole
pattern, not my sub-pattern. I know the subpattern is matching fine because
a replace (that does use sub-patterns) works fine.
Does anyone know how to retrieve the values of sub-pattern matches in
VBScript regular expressions?
Thanks!