简体   繁体   English

使用记事本++从文本文件中删除日期

[英]Remove date from text file with notepad++

I have a question about removing date and time from a text file with notepad++ . 我有一个关于使用notepad++从文本文件中删除datetime的问题。

I tried with this RegEx but still not working 我尝试使用此RegEx,但仍无法正常工作

\d{2}-\d{2}-\d{4}   \d{2}:\d{2}

The dates are like that: 日期是这样的:

04-21-1991  9:09    
04-21-1991  9:09    
04-21-1991  17:08   
04-21-1991  17:08   
04-22-1991  7:35    
04-22-1991  7:35    
04-22-1991  13:40   

{2} means exactly 2 {2}恰好是2

You should try this: 您应该尝试这样:

\d{2}-\d{2}-\d{4}  \d{1,2}:\d{2}

You have two mistakes in your regex, it looks like. 看起来你的正则表达式有两个错误。 The first is that the regex is looking for one more space than exists in the data. 首先是正则表达式正在寻找比数据中存在的空间更多的空间。 The second is that you're looking for "exactly two digits" for the hour, you want "one or two." 第二个是您正在寻找小时的“正好两位数”,而您想要“一两个”。

\d{2}-\d{2}-\d{4}  \d{1,2}:\d{2}

http://www.regexpal.com/ http://www.regexpal.com/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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