Highlighting a text excluding its presence within the span tags?

hi,
need help in writing a regex

I want to highlight the text when it is searched.
But I’m unable to write a proper regex. Basically, my search term is present within the tags as a class name and also the text is there outside the tags.

On search of that term it is highlighting the text within the also due to which the span tags opens up and breaks.
So I wrote this regex -> var searchRegExp = new RegExp(’(’ + searchTerm + ‘) +"(?!([^<]+)?>)"’, ‘gi’);
Now the problem is that if my search term is having > ,this also is not highlighted when searched.
Help me with the Regex.

This is my Regex which is not working properly -> var searchRegExp = new RegExp(’(’ + searchTerm + ‘) +"(?!([^<]+)?>)"’, ‘gi’);

The search term is passed into the javascript to highlight and that search term traverse over the texts to find the search term and highlights that term if present. Now I want the search term to exclude those sections of the texts where the search term is present within the tags and don’t want to highlight those. for that i wrote the Regex, but that regex is excluding the search term if that search term is present with the > in the texts where i want to highlight.

Have you been using a tool like regex101 to help you create your expressions?