Highlighting a text excluding its presence within the span tags?

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?

Just so I am clear about what you want and what is actually happening, can you provide a sample of text and then explain what part of that text you want to highlight and then what is actually being highlighted? I think I know what you want, but just want to make sure.