Help with preg_replace

As you said in your comment:

I only want to remove 2 per post.For each post I get a line tht reads “The Post xxx appeared first on xxx” at the bottom of both the excerpt and full text.

I’m glad you said so, regular expressions and XML parsing aren’t the nicest to deal with, but it turns out you don’t need to use either. This isn’t a WP feature but a Yoast SEO feature, and it can be turned off in the options:

screenshot of the Yoast SEO Search Appearance RSS settings tab