When entering data, process string at the same time through php or mysql?

reason
suppose I want to input all the data of a number table, how can I change the value of this field to B if there is A?

INSERT INTO `wp_posts` (`ID`, `content`)
VALUES
    (13335,"<h3></h3>\r\n[embed]https://www.instagram.com/p/Bcv_yv2lIIO/?utm_source=ig_embed[/embed]\r\n")

null

null
\ r\ n

< iframe src=
[/ embed] >

category is similar to this concept, what is the right thing to do?
or can I download string directly?

* *

becomes * *

whatever * * is, as long as it conforms to the rules?
is it faster than processing via php?
is to open a php file, and then delete the php file after writing it?


you can use the preg_replace and str_replace methods to replace data before publication.

PHP: preg_replace-Manual- http://php.net/manual/zh/func.

the pseudo code is as follows

$string_data = '';
$string_data = str_replace('\r\n','<br />',$string_data);
$string_data = str_replace('[embed]','<iframe src=',$string_data);
$string_data = str_replace('[/embed]','></iframe>',$string_data);
$string_data = preg_replace('!<\w+?>([\s\S]+?)</\w+?>!','\\1<br />',$string_data);
$string_data = preg_replace('!<[/]?\w+>!','',$string_data);
Menu