Finding/Replacing multiple strings in one document?

Finding/Replacing multiple strings in one document?

2
NewbieNewbie
2

    Nov 22, 2005#1

    I have a text file where I need to replace several strings with new strings. After reading several threads in this and in the macros section, I have gotten this far, where I can find and replace ONE string successfully:


    InsertMode
    ColumnModeOff
    HexOff
    UnixReOff
    Bottom
    IfColNum 1
    Else
    "
    "
    EndIf
    Top
    Loop
    Find "' '"
    IfFound
    "'SPACE'"
    IfEof
    ExitLoop
    EndIf
    EndLoop


    My problem is that I don't understand how to make it repeatedly loop to the top of the file and search for the next item I need replaced until it's searched for them all, and then stop. I will have to make this macro find/replace 10 or so separate strings of text.

    Here are a few examples of what I will need to find/replace, if it helps:
    Find "' '"
    IfFound
    "'SPACE'"

    Find "';'"
    IfFound
    "'SEMICOLON'"

    Find "','"
    IfFound
    "'COMMA'"

    Thanks in advance for any help you can provide!
    -sonofsamx

    6,686585
    Grand MasterGrand Master
    6,686585

      Nov 22, 2005#2

      In your macro an additional EndIf is missing. You have IfFound and IfEof, but only 1 EndIf. If all replaces are as easy as this one than use

      Find "search text1"
      Replace All "replace text 1"
      Find "search text2"
      Replace All "replace text 2"
      Find "search text3"
      Replace All "replace text 3"

      and throw away the IfFound and IfEof section. This is much faster than a loop. Don't forget to activate macro property Continue if a Find with Replace not found.
      Best regards from an UC/UE/UES for Windows user from Austria

      2
      NewbieNewbie
      2

        Nov 22, 2005#3

        Thank you so much, Mofi. I'm glad it was that easy to do and I appreciate your help! It works great now!

        (I had tried to use Replace All but had it as one word ReplaceAll and it broke - now I know why it wouldn't work! Dumb me... :))

        -sonofsamx