[英]Notepad++/Regex - How to conditionally switch the last 2 lines in a text file
I want to switch the last 2 lines of a file (so that the penultimate one is now the last one and reverse, BUT only in the situation where the penultimate line starts with a c. Preferably using any type of regex since I have to do this on various files. 我想切换文件的最后两行(以便倒数第二行现在是倒数第二行,然后倒转,但仅在倒数第二行以c开头的情况下。最好使用任何类型的正则表达式,因为我必须这样做在各种文件上。
thanks 谢谢
You can try this with notepad++: 您可以使用记事本++进行尝试:
search: (?<=\n)(c.*)(\r?\n)(.*)\Z
replace: $3$2$1
("dot match newline" must not be checked) (不得选中“点匹配换行符”)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.