用HTML标记替换字符串中的引号

Sud*_*dar 2 php string

我在PHP中的变量中存储了以下字符串.

The words inside the quotes should be in '''bold'''. Like '''this''' and '''that'''
Run Code Online (Sandbox Code Playgroud)

这里三重引号'''用于表示该单词应以粗体显示.

<strong>标签替换它的最有效方法是什么?

小智 9

我会说正则表达式是这样的:

$new_string = preg_replace('/\'\'\'([^\']+)\'\'\'/', '<strong>$1</strong>', $string);