How to exclude text from child elements?

I'm trying to extract the text of the main element, but don't want to include the text from the child elements of that element.

Now I get this result: "Text that I want!Text to exclude"

<p class="parent-class">
Text that I want!
<a href="www.URL.com" class="arrowlink">
<span class="child-class">Text to exclude</span>
</a>
</p>

I have tried something like this:
p:not(:has(.child-class))

Does anyone know if it is possible to exclude the text from the child element?

This can be done with regex, but you'll need to provide the real Html or web page to get better suggestions.