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

--- Comment #7 from hanya <[email protected]> ---
> run macro testit3 for text "89111112111;89031111190;89111111107"
> under regular expression "[0-9]{4,12}" output
> 89111112111,89031111190,89111111107 correct, but result for 
It replacing tend: 12 with 25 (second parameter) in this case. 
"12" is there only in the first part separated by ";". 
So this looks correct but it would not work with other string.

The following macro shows correct matches.

Sub SearchExample
  a = "1111233;2211111;89111112111;89031111190;89111111107"
  b = "[0-9]{4,12}"

  searcher = CreateSearcher(b)

  nStart = 0
  nEnd = Len(a)

  s = ""
  Do while nStart < nEnd
    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)
      s = s & ss & ","
      nStart = nStart + nMatchLen + 1
    else
      exit do
    end if
  loop

  msgbox s
End Sub

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

Reply via email to