Einzelnen Beitrag anzeigen
Alt 18.07.2004, 11:49   #9
flinx
Inventar
 
Registriert seit: 08.04.2001
Beiträge: 3.101


Standard

Quick & Dirty & ohne Gewehr:
Musst du noch für die anderen Figuren erweitern und den Fall eines Leerraumes einbauen.

Code:
Sub Suchen()
    ActiveDocument.Select
    Selection.Find.ClearFormatting
    With Selection.Find
        .Text = "[1-9].R???[K,Q,R,N,B,S,L,T,D]"
        .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchAllWordForms = False
        .MatchSoundsLike = False
        .MatchWildcards = True
    End With
    While Selection.Find.Execute    
    Selection.Text = Replace(Selection.Text, "R", "T", 1, 1)
    Wend
    ActiveDocument.Select
    Selection.Find.ClearFormatting
    With Selection.Find
        .Text = "[1-9].[K,Q,R,N,B,S,L,T,D]???R"
        .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchAllWordForms = False
        .MatchSoundsLike = False
        .MatchWildcards = True
    End With
    While Selection.Find.Execute
    Selection.Text = StrReverse(Replace(StrReverse(Selection.Text), "R", "T", 1, 1))
    Wend
End Sub
Edit:
[1-9].R?[1-9]?[K,Q,R,N,B,S,L,T,D] bzw.
[1-9].[K,Q,R,N,B,S,L,T,D]?[1-9]?R
wäre ev. etwas genauer.
flinx ist offline   Mit Zitat antworten