On Jan 22, 2007, at 11:09 AM, Charles Yeomans wrote:


On Jan 22, 2007, at 12:50 PM, Chuck Pelto wrote:


On Jan 22, 2007, at 8:55 AM, Phil Heycock wrote:

rg.Options.Greedy = False

No joy....

Same result. Only 1 is returned by theMatch.SubExpressionCount.


This is how RegEx.Search works. If you want to find all matches, you'll need to call Search more than once.

So.....

....what is the functionality of SubExpressionCount?

What is meant by....

Number of SubExpressions that are available with the search just performed.

Is it supposed to return the number of matched patterns? Or is it supposed to return something else? If the latter, what must be done to find the number of patterns that matched the search pattern?

I've tried using another example I found while rummaging around in the archives. It seems to support the recursion approach you suggest. But it doesn't indicate 3 uses of the word "test" either.

Here is the new code....

  // 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

  strInput = "test this 'chuck pelto' test 'susan pelto' test another"

  srchPatt = "test"  // just a test search for the word "test"

  rg.SearchPattern = srchPatt

  rg.Options.Greedy = False

  theMatch = rg.Search(strInput)

  while theMatch<> nil and theMatch.subExpressionCount >= 1
    strQuots = theMatch.subExpressionString(1)
    theMatch = rg.search()
  wend

It seems that no matter what I do, SubExpressionCount always returns 1. Is there a problem with this call?

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>

Reply via email to