1
<span class="xyz">z
      <span>abc</span>
      <span>cdf</span>
 </span>

This is my sample code and must replace like this

<span class="xyz">z
      <span>abc</span>
      <span>cdf</span>
 $</span>
Ted Lyngmo
  • 93,841
  • 5
  • 60
  • 108
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Mar 17 '23 at 19:18
  • You can't do such job with regex. Use a parser with your favorite scripting anguage. [You can't parse xml with regex](https://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags/1732454#1732454) – Toto Mar 19 '23 at 16:36

1 Answers1

0

A very basic solution would be /(<span[^>]*>)(.*?)(<\/span>)/

https://regex101.com/r/BbTxJ3/1

I don't know what regex flavor notepad++ uses, so I can't say that the replace code would be the same, but I'm sure you'll be able to work with this

Buttered_Toast
  • 901
  • 5
  • 13
  • z It must work with specific class says katex, there are more middle span tags for which it should not be replaced. (Only entry level span tag with specific class) note pad++ with HTML – SEKHAR NAIDU Bathini Mar 19 '23 at 14:11
  • Update your question to include all this information, I answered based on the currently available information in the question. I still don't know how to read minds – Buttered_Toast Mar 19 '23 at 15:31