Search code examples
regexnotepad++

Regex match all specific chars between 2 words (or match within capture group)


tried (?<=description\>)o(?=\<\/description) and (description)(.*?)(description))(\1o)
to match all 'o' between 'description' tags.
Unfortunately I cannot find a way to do that.

<catalog>
   <book id="bk101">
      <author>Gambardella, Matthew</author>
      <title>XML Developer's Guide</title>
      <genre>Computer</genre>
      <price>44.95</price>
      <publish_date>2000-10-01</publish_date>
      <description>An in-depth look at creating applications with XML.</description>
   </book>
   <book id="bk102">
      <author>Ralls, Kim</author>
      <title>Midnight Rain</title>
      <genre>Fantasy</genre>
      <price>5.95</price>
      <publish_date>2000-12-16</publish_date>
      <description>A former architect battles corporate zombies, an evil sorceress, and her own childhood to become queen of the world.</description>
   </book>
</catalog>

Solution

  • You may use

    (?:\G(?!\A)|<description>)(?:(?!</description>)[^o])*\Ko
    

    See a demo on regex101.com.