preg_match all paragraphs in a string

前端 未结 2 1498
情书的邮戳
情书的邮戳 2021-01-24 04:12

The following string contains multiple

tags. I want to match the contents of each of the

with a pattern, and if it matches, I want

2条回答
  •  面向向阳花
    2021-01-24 04:39

    • Create a capture group on the

      tag

    • Use preg_replace

    https://regex101.com/r/nE5pT1/1

    $str = "

    para 1

    نص عربي أو فارسي

    para3

    "; $result = preg_replace("/(

    )[\\x{0590}-\\x{05ff}\\x{0600}-\\x{06ff}]/u", "

    ", $str, 1);

提交回复
热议问题