У меня есть следующий кодКак мне получить preg_match, чтобы показать первый экземпляр?
$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];
Это его возвращения следующее:
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.)
Мне нужно, чтобы вернуться:
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, но он вернулся и те же результаты ,
Я рассмотрел весь вопрос для ответа на мой вопрос и не смог найти ответ, который касался его.
Заранее спасибо.
Если мой ответ помог вам, пожалуйста, рассмотреть вопрос о принятии его в качестве правильного ответа. ТКС. –