小编Rac*_*mad的帖子

如何拆分文本以匹配双引号加上尾随文本到点?

我怎样才能得到一个双引号的句子,其中有一个必须分割的点?

像这样的示例文档:

"国际象棋帮助我们克服困难和痛苦,"Unnikrishnan说,带走了我的女王."在棋盘上,你正在战斗.因为我们也在为日常生活中的艰辛而战."他说.

我想获得这样的输出:

Array
(
    [0] =>"Chess helps us overcome difficulties and sufferings," said Unnikrishnan, taking my queen.
    [1] =>"On a chess board you are fighting. as we are also fighting the hardships in our daily life," he said.
 )
Run Code Online (Sandbox Code Playgroud)

我的代码仍然被点破坏.

function sample($string)
{
    $data=array();
    $break=explode(".", $string);
    array_push($data, $break);

    print_r($data);
}
Run Code Online (Sandbox Code Playgroud)

关于双引号和点分割两个分隔符,我仍然很困惑.因为在双引号内有一个包含点分隔符的句子.

php regex unicode preg-split

6
推荐指数
1
解决办法
182
查看次数

标签 统计

php ×1

preg-split ×1

regex ×1

unicode ×1