Hi all,

The method XTextSearch.searchForward results an
com.sun.star.util.SearchResult structure

http://api.openoffice.org/docs/common/ref/com/sun/star/util/SearchResult.html

As you can see, IDL documentation says that setting the searchAlgorithm to 
REGEXP I can find multiple sub matches but, in my tests I'm obtaining ever 
and only the first one

At the end of this post there's my testing code
am I doing something wrong ?
Perhaps I missed some SearchFlags ?


Thanks in advance for any help
Paolo M.


REM  *****  BASIC  *****

Sub Main

oTextSearch = CreateUnoService("com.sun.star.util.TextSearch")

        Dim aSrcOpt As New com.sun.star.util.SearchOptions
        With aSrcOpt
                .searchFlag = com.sun.star.util.SearchFlags.REG_EXTENDED
                .algorithmType = com.sun.star.util.SearchAlgorithms.REGEXP
                .searchString = "[:digit:]+"
        End With

        oTextSearch.setOptions(aSrcOpt)
        sStrToSearch = "1 sometext 33 othertext 654"
        aSearchResult = oTextSearch.searchForward(sStrToSearch, 
0,Len(sStrToSearch)-1 )
        
        If aSearchResult.subRegExpressions > 0 Then
                For I = LBound(aSearchResult.startOffset()) To 
UBound(aSearchResult.startOffset())
                        
                        iMatchStartPos = aSearchResult.startOffset(I) + 1
                        iMatchLen = aSearchResult.endOffset(I) - 
aSearchResult.startOffset(I)
                        sMatchString = Mid(sStrToSearch, iMatchStartPos, 
iMatchLen)
                        
                        MsgBox sMatchString
                        
                Next I
        End If

End Sub

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to