Extracting all values between curly braces regex php

前端 未结 3 1443
醉酒成梦
醉酒成梦 2020-11-28 13:22

I have content in this form

$content =\"

This is a sample text where {123456} and {7894560} [\'These are samples\']{145789}

\";
3条回答
  •  鱼传尺愫
    2020-11-28 14:19

    DEMO :https://eval.in/84197

    $content ="

    This is a sample text where {123456} and {7894560} ['These are samples']{145789}

    "; preg_match_all('/{(.*?)}/', $content, $matches); foreach ($matches[1] as $a ){ echo $a." "; }

    Output:

    123456 7894560 145789 
    

提交回复
热议问题