Menu

RegExp Replace

2008-02-08
2012-11-13
  • Nobody/Anonymous

    I wanted to fix some SQL statements.
    Each line ended with ";" which was giving errors.
    I wanted to replace ";" with CRLF and "GO"

    There was no apparent way, so I resorted to ASCII replace of ";" with ";GO"
    I had to use the Hex editor to change ";" (3B) to 0D

    Normal replace didn't work.

    Any clues for users in the real world ?
    (Sheesh, even old Crimson Editor can do a replace of ";" with "^P GO" )

     
    • fidvo

      fidvo - 2008-02-08

      Use the Advanced Editor (CTRL-R).

      In the Find field, put ";"

      In the Replace field type CTRL-M followed by "GO"

       
    • Nobody/Anonymous

      Perhaps it is more safe to select one ; at the end of a line, including the CRLF and then press CTRL+R. Also the newline character is selected now, so you won't replace ;'s in the middle of lines.

       
      • fidvo

        fidvo - 2008-02-10

        That's a good point about not replacing ;'s in the middle of the line.  You could also do it with:

        Find Field:

        ";" then CTRL-M

        Replace Field:

        CTRL-M then "GO" then CTRL-M again.