Find specific word between tag start and end

I need to find a word this within <template> and </template>:

I tried <template>([this])*?</template> but it doesn’t seem to work.


Your regular expression is matching strings that

  • are starting with <template>,
  • followed by an arbitrary combination of the characters t, h, i or s with arbitrary length, e.g., thssiththissiththhtht would be matched by ([this])*,
  • are ending with </template>,

Does this solution work for you?


.* matches an arbitrary number of arbitrary characters, except for new lines. So, I added n and r with the OR operator |. (?:...) means, it’s a non-capturing group, i.e., when asking for groups, this group won’t show up.