Christian Schmitz wrote:

Hat keiner eine Idee dazu?


Die Übersetzung:

dim r as new RegExMBS
dim searchString as string = "^$"

r.CompileOptionCaseLess = false
r.CompileOptionNewLineAny = true
r.ExecuteOptionNewLineAny = true
r.CompileOptionMultiLine = true

if r.Compile(searchString) then

dim s as string="Hello World"+EndOfLine+EndOfLine+"Hello"+EndOfLine
dim w as string = r.ReplaceAll(s, "Würzburg")

MsgBox w

else
MsgBox "failed to compile"
end if

Aber ich schick dir noch ein neues Plugin. Ich hab noch 'nen Bug gefunden beim 
ReplaceAll.

Ich konnte zumindest einen Teil der benutzten Routinen umschreiben.
Jetzt fehlt mir nur noch ein Ersatz für:
 Dim rg as RegEx
 Dim myMatch as RegExMatch

 rg.Options.CaseSensitive=True
 rg.Options.ReplaceAllMatches=True
 rg.SearchPattern=suchstring
 rg.ReplacementPattern=ComboBox2.Text

 myMatch=rg.Search("In Würzburg gibt es hübsche Mädchen.")
 if myMatch<>nil then
   s=myMatch.SubExpressionString(0)
 end

Mir fehlt also die Möglichkeit, das Ergebnis der RexEx-Suche zu
erhalten (der erste Treffer würde mir reichen). Gefunden habe ich das
Beispiel auf Deiner Seite:
<http://www.monkeybreadsoftware.net/class-regexmbs.shtml>

dim r as new RegExMBS
dim searchString as string = ".o"

if r.Compile(searchString) then

 dim s as string="Hello World"

 dim start as integer = 0
 while r.Execute(s,start)>0

   dim p as integer = r.OffsetCharacters(0)
   dim l as integer = r.OffsetCharacters(1)-r.OffsetCharacters(0)

   MsgBox "Found "+searchString+" on position "+str(p)+" with length
"+str(l)+" in """+s+""""

   start = r.OffsetCharacters(1)
 wend

else
 MsgBox "failed to compile"

Ich finde das für meinen Fall recht aufwändig. Gibt es das nichts
einfacheres?

MfG, Metti.
end if

Antwort per Email an