https://issues.apache.org/ooo/show_bug.cgi?id=122708

[email protected] changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |NOTABUG

--- Comment #9 from [email protected] ---
Problem is missed by modify function code.


Function regex(a as string,b as string)

' Attention - made by novice, so can contain bugs

' a - string or cell to search in
' b - regexp string or cell containing regexp string


' prepare regexp search options
oTextSearch = CreateUnoService("com.sun.star.util.TextSearch")
oOptions = CreateUnoStruct("com.sun.star.util.SearchOptions")
oOptions.algorithmType = com.sun.star.util.SearchAlgorithms.REGEXP
oOptions.searchString = b
oTextSearch.setOptions(oOptions)
' search first substring
oFound = oTextSearch.searchForward(a, 0, Len(a))

oTextSearch = CreateUnoService("com.sun.star.util.TextSearch")
oOptions = CreateUnoStruct("com.sun.star.util.SearchOptions")
oOptions.algorithmType = com.sun.star.util.SearchAlgorithms.REGEXP
oOptions.searchString = b
oTextSearch.setOptions(oOptions)

  searcher = oTextSearch(b)

  nStart = 0
  nEnd = Len(a)

  regex=""
  ss=""
  Do while nStart < nEnd-2
    r = searcher.searchForward(a,nStart, nEnd)
    if 0 < r.subRegExpressions then
      nMatchLen = r.endOffset(0) - r.startOffset(0)
      ss = Mid(a, r.startOffset(0) + 1, nMatchLen)
      if regex = "" then
        regex = ss
      else
        regex = regex &";" &ss
      end if
      nStart = nStart + nMatchLen + 1
    else
      exit do
    end if
  loop


End Function

-- 
You are receiving this mail because:
You are on the CC list for the bug.
You are the assignee for the bug.
You are watching all bug changes.

Reply via email to