On Jan 22, 2007, at 11:43 AM, Charles Yeomans wrote:
In a regular expression you can define subexpressions using
parentheses. You then use the Subexpression methods of a
RegExMatch object to get the matches of the subexpressions.
Okay....I think I follow, now. SubExpressionCount is NOT a count of
the number of items that match the search pattern. It's something
else that I don't quite understand just yet.
With that hurtle overcome, THIS code actually works.....
Sub TestRegEx()
// method to test aspects of Regular Expressions
dim rg as New RegEx
dim theMatch as RegExMatch
dim strInput as string
dim strQuots as string
dim srchPatt as string
dim iCount as integer
dim i as integer
iCount = 0
strInput = "test1 this 'chuck pelto' test2 'susan pelto' test3
another"
srchPatt = "test"
rg.SearchPattern = srchPatt
rg.Options.Greedy = False
theMatch = rg.Search(strInput)
while theMatch<> nil
iCount = iCount + 1 // catch how many times we go through this
process to see if it matches the number of patterns matched
strQuots = theMatch.subExpressionString(0) // use of 1 in the
parens here doesn't work
theMatch = rg.search() // leave the parens empty to use the
previously searched on target text
wend
Thanks for your patience and support.
Regards,
Chuck
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>