简体   繁体   中英

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 .

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

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.

以下正则表达式应与您的to_timestamp()调用匹配,请尝试将其用作查找/替换模式。

to_timestamp\('[0-9]{2}-[A-Z]{3}-[0-9]{2} (?:[0-9]{2}.){3}[0-9]{9} [AMP]{2}','DD-MON-RR HH.MI.SS.FF AM'\)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM