realbasic-nug
[Top] [All Lists]

Re: udsbvegd : RegEx.SearchStartPosition isn't updating properly - NOT A

To: REALbasic NUG <realbasic-nug at lists dot realsoftware dot com>
Subject: Re: udsbvegd : RegEx.SearchStartPosition isn't updating properly - NOT A BUG
From: Guyren Howe <guyren at mac dot com>
Date: Tue, 30 Jan 2007 22:41:39 -0600
Delivered-to: listarchive at realsoftware dot com
Delivered-to: realbasic-nug at lists dot realsoftware dot com
References: <JNEMKODMMFHECCENBEECOEEOHLAA dot rblists at rbtips dot com>
On Jan 30, 2007, at 9:55 PM, Carlos M wrote:

On Jan 29, 2007 8:59 PM, Guyren Howe wrote:
<http://realsoftware.com/feedback/viewreport.php?reportid=udsbvegd>

In 2K7r1, the first regex match against a string updates the
SearchStartPosition, but subsequent searches only ever find the first
match, and SearchStartPosition isn't updated.

This is *not* correct.
The problem is that you're not using RegEx.Search correctly ;-)

In this example, that you posted with the report,
  Dim r As New RegEx
  Dim m As RegExMatch

  Dim searchString As String = "abcdabce"

  r.SearchPattern = "abc(d|e)"
  m = r.Search(searchString)
  Break //Here, r.SearchStartPosition = 4, as it should be
  m = r.Search(searchString)
Break //Here, r.SearchStartPosition = 4, and we still find the first pattern

the second time you use Search you cannot use the "searchString" for the
TargetString parameter and you should only use:
 m = r.Search() // without the TargetString
and then you'll get 8 for the r.SearchStartPosition.

I guess I should read the docs more closely. Thanks.
_______________________________________________
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>


<Prev in Thread] Current Thread [Next in Thread>