regex - How can i remove before and after a particular xml tags in notepad++? -


i have huge xml file has many xml file in each line.(so there thousands of xml lines) want remove tags before , after tag every line regardless of tag position in line.

**input xml:**  <main><firstname>xyz123</firstname><employer>abc co.</employer><salary>1000</salary><description>manager</description></main> <main><firstname>xyz123</firstname><employer>abc co.</employer><salary>1000</salary></main> <main><firstname>xyz123</firstname><salary>1000</salary><description>manager</description></main> <main><firstname>xyz123</firstname><employer>abc co.</employer><salary>1000</salary><description>manager</description></main>  **output this:** <employer>abc co.</employer> <employer>abc co.</employer> <employer>abc co.</employer> <employer>abc co.</employer> 

not sure understand needs, guess want:

  • ctrl+h
  • find what: ^.*(<employer>.*?</employer>).*$
  • replace with: $1
  • replace all

explanation:

^               : begining of line   .*            : 0 or more character   (             : start group 1     <employer>  : literally     .*?         : 0 or more character, non greedy     </employer> : literally   )             : end group 1   .*            : 0 or more character $               : end of line 

Comments