如何使用正则表达式替换 - 在此日期中使用/

时间:2017-05-18 14:31:54

标签: regex text notepad++

我的数据行如下

,NULL,1-035-137,8 ,, NULL,----,NULL,NULL,2017-04-20 13:43:25,2017-04-20 13:43:25,2017- 04-20 13:43:25,NULL,

我需要在notepad ++中替换--with / using regex

我可以使用\ d {4}选择它 - \ d {2} - \ d {2}是否可以只替换“ - ”?

谢谢大家。

1 个答案:

答案 0 :(得分:1)

使用capturing groups

查找内容(\d{4})-(\d{2})-(\d{2})
替换为$1/$2/$3

此处,(...)定义了您使用$n backreferences引用的编号捕获组。请注意,为了更安全的匹配,您可以在模式周围添加单词边界 - \b(\d{4})-(\d{2})-(\d{2})\b

enter image description here

相关问题