php – How do I open a tag at the beginning of the sentence and "automatically" close it at the end of the line?

I have a text with several phrases one below the other and have to process each phrase differently. I wanted to open a tag (eg 🙂 and want the text editor (vscode) to automatically close this tag "at the end of sentence.
Question 1: Is there or can I add a link to close the tag at the end of the line after the sentence?
Question 2: Is it possible to set conditions using words or letters so that the tags are created at the beginning and end of each sentence?

Example text with phrases:
The most important thing is not to win every day, but always to fight.
The shame of not having fought is greater than the sadness of not having won!
It's better to conquer yourself than to win a thousand battles.
Those who dared to conquer and fight go on!
As long as there is a will to fight, there is hope to win.

Note: If I had a way to create a rule that uses the word ex: "battles", create a day in the line at the beginning and end of the sentence.

Thanks glr!

Features – How do I check if an open page is a toilet related page?

I have to recognize all toilet-related pages (products, individual products, cash register, etc.) on one website.

I added that wp Action in the functions.php and tried it with is_shop() Function, but it doesn't work. Here is the code I tried to do this with

add_action('wp', 'page_loaded');

function page_loaded() {
   if (is_shop()) {
      // Some code here

Is there any way to do this?