I'm trying to get text between two characters that need to be replaced with preg_replace, but, alas, it’s still not entirely correct, since I get empty output, which is an empty string, this is what I still have
$start = '["';
$end = '"]';
$msg = preg_replace('#('.$start.')(.*)('.$end.')#si', '$1 test $3', $row['body']);
So, the result of the output I'm looking for will be as follows:
normal text [everythingheregone] after text
For
normal text [test] after text
source
share