简体   繁体   English

使用崇高文本查找和替换XML值

[英]Find and replace XML value using sublime text

I'm trying to write a regex expression (or find some other easier method) to find and replace all values between the xml tags in sublime like the following: 我正在尝试编写一个正则表达式(或找到其他一些更简单的方法)来查找和替换sublime中xml标记之间的所有值,如下所示:

Find value of SENDERNAME 寻找SENDERNAME的价值

   <SENDERNAME>TEST</SENDERNAME>

Replace value and turn into 替换值并变成

<SENDERNAME>REPLACED<SENDERNAME>

I'm having trouble writing regex for it as I am a beginner. 我是新手,因此无法为其编写正则表达式。 I need to do this for 100's of tags so I need code to replace them all. 我需要为100多个标签执行此操作,因此我需要代码来替换所有标签。 I'm not finding any tutorials or easy ways of doing it with just sublime. 我没有找到任何教程或简单的方法来做到这一点。

Thanks in advance, 提前致谢,

Mark 标记

It would be easier to replace the whole tag, than to actually replace the value within. 替换整个标签比实际替换其中的值要容易。 You can search for the following regex: 您可以搜索以下正则表达式:

<SENDERNAME>.*</SENDERNAME>

and replace it with the new value 并将其替换为新值

<SENDERNAME>REPLACED</SENDERNAME>

尝试以下RegEx: <SENDERNAME>[^<>]*</SENDERNAME>

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

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