vim 正则表达式替换
source link: https://www.v2ex.com/t/803602
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
有一批类似这样的数据:
('526440130559344640','2',7,to_date('2020-11-18 00:00:00','yyyy-mm-dd hh24:mi:ss'),'0',null,null,to_date('2020-11-26 01:48:39.705','yyyy-mm-dd hh24:mi:ss')),
('526440158212390912','2',3,to_date('2020-11-18 00:00:00','yyyy-mm-dd hh24:mi:ss'),'0',null,null,to_date('2020-11-26 01:48:39.705','yyyy-mm-dd hh24:mi:ss')),
如何使用正则表达式批量将里边的 to_date 这一段,
to_date('2020-11-26 01:48:39.705','yyyy-mm-dd hh24:mi:ss')
提取出里边的日期,并替换掉这一段内容
to_date('2020-11-26 01:48:39.705','yyyy-mm-dd hh24:mi:ss') => '2020-11-26 01:48:39.705'
最终数据变为下边的格式
('526440130559344640','2',7,'2020-11-18 00:00:00','0',null,null,'2020-11-26 01:48:39.705'),('526440158212390912','2',3,'2020-11-18 00:00:00','0',null,null,'2020-11-26 01:48:39.705'),
Recommend
-
51
问题的起因来自于一段正则替换。为了从一段HTML代码里面提取出正文,去掉所有的HTML标签和属性,可以写一个Python函数: import re def remove_tag(html): text = re.sub('<.*?>', '', html, re.S) return tex...
-
3
技术之前,先读诗书:空里流霜不觉飞,汀上白沙看不见。 VSCode巧妙使用正则替换提高效率 ...
-
2
python正则表达式替换字符串 作者:the5fire | 标签: html格式化
-
3
分析一正则表达式替换例子 作者: JavasBoy 分类:
-
4
V2EX › 程序员 VSCode 正则表达式替换的两个大坑 AndyAO · 16 分钟前 · 52 次点击 ...
-
5
星期日, 六月 14, 2020 VIM学习笔记 正则表达式-(vimgrep/grep) 在UNIX问世的前一年,1969年,Ken Thompson将正则表达式整合入QED文本编辑器...
-
6
【代码】JS通过正则表达式替换字符串 2022-12-11 JS通过正则表达式替换字符串 将<、>、"、&替换成实体字符...
-
3
敢一行,则予知。脚踏实地,知行合一。 需求是这样的,我需要将...
-
1
Vim 的替换查找是其核心功能, 功能极其强大, 通过其规则匹配, 可以很快速地完成我们很多需要大量人力操作的工作, 而且可对多文件使用查找/替换功能.
-
1
【笔记】Python3 通过正则表达式替换子串 2023-07-07
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK