Search code examples
regexnotepad++

String value to replace using regex in Notepad++


I have Notepad++ text editor and have the SQL script file that has many INSERT statements, exported from a table. There is a column TIMESTAMP in every row with value like this to_timestamp('08-NOV-13 11.51.51.480570000 AM','DD-MON-RR HH.MI.SS.FF AM').

I need to create a script and replace the above value with current_timestamp so all to_timestamp('08-NOV-13 11.51.51.480570000 AM','DD-MON-RR HH.MI.SS.FF AM') like values will be replaced with current_timestamp.

Also, let me know if there is any online site available to do do this conversion.


Solution

  • I think Sublime Text is very ideal for your needs.

    Open Sublime Text, copy your input onto the text area, press Ctrl+H, press Alt+R, and input the following pattern:

    to_timestamp\([^)]+\)
    

    in the "Find What" text box. Now enter "current_timestamp" (without quotes) in the "Replace with" text box, then press "Replace" or "Replace All" and it's done.