Elc*_*007 6 regex search replace notepad++
我的 .txt 文档中有数千条记录的列表。其中一些看起来像这些记录
201910031044 "00059" "11.31AG" "Senior Champion"
201910031044 "00060" "GBA146" "Junior Champion"
201910031044 "00999" "10.12G" "ProAM"
201910031044 "00362" "113.1LI" "Abcd"
Run Code Online (Sandbox Code Playgroud)
每当出现类似的记录时,我想去掉最后引号中的最后一个单词/数字/等(例如“高级冠军”,“少年冠军”等。这里有很多可能性)
例如(之前)
201910031044 "00059" "11.31AG" "Senior Champion"
Run Code Online (Sandbox Code Playgroud)
后
201910031044 "00059" "11.31AG"
Run Code Online (Sandbox Code Playgroud)
我尝试了以下正则表达式,但它不起作用。
搜索:^([0-9]{17,17} + "[0-9]{8,8}" + "[a-zA-Z0-9]").*$
替换:(\1替换字符串)
好吧,我忘记了.(点)符号,但是即使我没有.(点)符号,它也不起作用。+不确定是否与使用多次使用的标志有关。
我想去掉最后一个引号中的最后一个单词/数字/等
这完成了工作:
^.+\K\h+".*?"$ LEAVE EMPTY. matches newline*解释:
^ # beginning of line
.+ # 1 or more any character but newline
\K # forget all we have seen until this position
\h+ # 1 or more horizontal spaces
".*?" # something inside quotes
$ # end of line
Run Code Online (Sandbox Code Playgroud)
屏幕截图(之前):
屏幕截图(之后):