简体   繁体   中英

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:

Find value of 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. 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>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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