Good Night, I'm having a big problem, it's the following, I'm having a textarea form to send texts to the database, and what I want to do is to get a snippet or a word that is contained between certain characters and modify them to a tag ... To clarify is this:
Let's suppose I want to get the text that is within two dashes (-): This is a -Text- of Example ... And the result I want is, whenever the user places a word or an excerpt of the text I want to change them to: This is a Text of Example.
I tried with str_replace, but I did not get the desired result.
$text = $_POST['publicacaoText'];
$publicacaoStrip = str_replace("/*", "<b>", $text);
$publicacaoStrip = str_replace("*/", "</b", $publicacaoStrip);
So it goes well, maaas type, if I put it twice in a row like this: Breno Castro / ... He does what I want, But do not add the Espalo between the two words, that is, I wanted to make the system bold and italic like neither WhatsApp -Breno- + Castro + , and I realized that here in the stackoverflow also has the same system. Please if anyone can help me, thank you, you're too old.
Notice also that I have tried this way:
$publicacaoStrip = str_replace("-$text-", "<b>$text</b>", $publicacaoStrip);
OR
$publicacaoStrip = str_replace("-".$text."-", "<b>$text</b>", $publicacaoStrip);
And of course it did not work kkkkk It was stupid to have tested like this, but I made sure kkkkkk
Please help me, I need you so much
If anyone knows how to do this also with JQuery too, but preferred is with PHP please