如何让我的 preg_match 显示第一个实例?

How do i get my preg_match to show the first instance?

我有以下代码

    $atk="[2] Skedaddle (20) Shuffle Aipom and all basic Energy cards attached to it into your deck. (Discard all other cards attached to Aipom.) (If you have no Benched Pokemon, this attack does nothing.)";

    preg_match('#\[(.*)\] (.*) \((.*)\) (.*)#', $atk2, $matchatk2);
    $atkcost = $matchatk2[1];
    $atkname = $matchatk2[2];
    $atkdmg = $matchatk2[3];
    $atktext = $matchatk2[4];

它 return 如下:

2
Skedaddle (20) Shuffle Aipom and all basic Energy cards attached to it into your deck.
Discard all other cards attached to Aipom.
(If you have no Benched Pokemon, this attack does nothing.)

我需要它 return:

2
Skedaddle 
20 
Shuffle Aipom and all basic Energy cards attached to it into your deck. (Discard all other cards attached to Aipom.)(If you have no Benched Pokemon, this attack does nothing.)

我已经尝试 perg_match_all 但它 return 得到了相同的结果。

我找遍了我的问题的答案,但找不到与之相关的答案。

提前致谢。

您需要 非贪婪 正则表达式量词 ?

像这样:

 $atk="[2] Skedaddle (20) Shuffle Aipom and all basic Energy cards attached to it into your deck. (Discard all other cards attached to Aipom.) (If you have no Benched Pokemon, this attack does nothing.)";

    preg_match('#\[(.*?)\] (.*?) \((.*?)\) (.*)#', $atk, $matchatk2);
    $atkcost = $matchatk2[1];
    $atkname = $matchatk2[2];
    $atkdmg = $matchatk2[3];
    $atktext = $matchatk2[4];

演示: http://ideone.com/36DRLa

Mastering Quantifiers