2016-11-22 75 views
0

我在NotePad ++中有以下文本,我正在尝试编写正则表达式来查找并替换为以下内容。记事本++ - 正则表达式 - 数字和日期

Find: #,##/ (Look for the pattern 2,10/) 
Replace: #\r (at the comma replace with a new line, so the date starts on a new line) 



11/02/2016,18,54,61,13,37,05,2,10/29/2016,42,48,20,21,19,23,3,10/26/2016,48,56,02,16,03,24,2,10/22/2016,01,55,33,28,56,22,2,10/19/2016,43,63,16,38,10,23,2,10/15/2016,64,49,57,23,67,20,2,10/12/2016,34,44,30,16,37,16,2, 

回答

0

您似乎在寻找捕获组:捕获不同部分,应该用换行符分割,并在替换模式中使用反向引用。

搜索(\d,)(\d+/)
更换$1\n$2

见NPP截图:

enter image description here

+1

搜索条件应该是这样的'(\ d,)(\ d + \ /)'。 '/'字符应该被转义。 – AlphaQ

+1

@AlphaQ:'/'字符不是一个特殊的正则表达式字符,不应该被转义。请参阅regex101.com上的[证明](https://regex101.com/r/CbX8Y3/1)。 –

+0

但它报告了错误[here](http://regexr.com/3enkq) – AlphaQ

0

此正则表达式将工作:(\d),(\d\d/)

替换为:\1\r\2

结果例子:

After "Replace All"