简体   繁体   English

正则表达式在记事本++中用<替换文本

[英]Regex replace text with < in Notepad++

I am having a hard time with replacing this text with something else . 我很难用其他内容替换此文本。 This XML uses also next lines . 该XML也使用下一行。

     <Need>
        <Need type="money" amount="100"/>
     </Need>

I have tried it with this : 我已经尝试过了

<Need>([\n]*[a-Z]*)</Need>

<Need>(?:[^\n]*(\n+))+</Need>

<Need>([^\n]*[0->]*[a-Z]*)</Need>

<Need>([^\n]*[a-Z]*)</Need>

Non of them worked and 2 deleted the whole text :( . 他们中没有一个有效,2删除了全文:(。

Find: 找:

<Need>(.*?)</Need>

Replace by: 替换为:

$1

Be sure that: 请确保:

  • regular expression is checked. 正则表达式被检查。
  • . (dot) matches newline is checked. (点)匹配换行符。

使用它进行广泛的搜索并考虑空格和换行符进行替换。

[\s]*<Need>[\r\s]*<Need[^/]*/>[\r\s]*</Need>

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

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