简体   繁体   English

Notepad ++正则表达式文本替换

[英]Notepad++ regex text replace

I have a text file. 我有一个文本文件。

tart*)*98'bank'ksb64bank)(tart2d&f44bank

I want to replace to: I want search tart*.*bank and change "bank" to "replaced" 我想替换为:我想要搜索**。bank,并将“ bank”更改为“ replaced”

tart*)*98'replaced'ksb64bank)(tart2d&f44replaced

Thanks. 谢谢。

Find what: (tart.*?)(bank) 查找内容: (tart.*?)(bank)

Replace with: \\1replaced 替换为: \\1replaced

  • () are for grouping so you can reference groups in replace with field like \\1 for first group ()用于分组,因此您可以在第一个组的\\1类的字段中替换组
  • .* is greedy and it would match the rest of the string so ? .*是贪婪的,它将与字符串的其余部分匹配,所以? is for making .* non-greedy and matching only until first bank is not matched 用于使.*为非贪婪,并且仅在第一个bank不匹配之前进行匹配

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

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