rg.Options.Greedy = False

****************

on 1/22/07 9:50 AM, Chuck Pelto at [EMAIL PROTECTED] wrote:
> On Jan 18, 2007, at 10:28 AM, Phil Heycock wrote:
> 
>> How about RegEx? (I didn't test the following, but something like
>> it ought
>> to work).
>> 
>> Dim reg As New RegEx
>> Dim regResults As RegMatch
>> 
>> reg.SearchPattern = "\b(\d+)\b" // word boundary - word - word
>> boundary
>> 
>> regResults = reg.Search(yourText)
>> 
>> Dim matchNum As Integer
>> For matchNum  = 1 To regResults.SubExpressionCount
>>     nextWord = regResults.SubExpressionString(matchNum)
>> Next matchNum
> 
> I'm teaching myself RegEx and developed something akin to this
> methodology you suggested.
> 
> However, what I'm experiencing is 'odd'.
> 
> I've got a source text that has the word "test" in it several times.
> 
> But for some strange reason the regResults.SubExpressionCount is only
> returning a value of 1. Not the number of instances of the word
> "test" in the target string.
> 
> Here's my 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"  // look for word "test"
> 
>  rg.SearchPattern = srchPatt
> 
>  theMatch = rg.Search(strInput)
> 
>  iCount = theMatch.SubExpressionCount
> 
>  for i = 1 to iCount
> 
>    strQuots = theMatch.SubExpressionString(i)
> 
>  next
> 
> Why is it only returning a value of 1 when there are three instances
> of the word "test" in the target string?
> 
> 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