$re = '/\|poke\|p([1,2])\|(.+?)(,|\|)/m';
$str = '|poke|p1|Volcarona, M|
|poke|p1|Urshifu-*, F|
|poke|p1|Magnezone|
|poke|p1|Tangrowth, M|
|poke|p1|Corviknight, F|
|poke|p1|Hippowdon, F|
|poke|p2|Togekiss, M|
|poke|p2|Kommo-o, M|
|poke|p2|Jirachi|
|poke|p2|Mimikyu, F|
|poke|p2|Dragalge, F|
|poke|p1|Dragapult, F|
|poke|p1|Hatterene, F|
|poke|p1|Flygon, F|
|poke|p1|Inteleon, F|
|poke|p1|Obstagoon, F|
|poke|p1|Arcanine, F|
|poke|p2|Pincurchin, F|
|poke|p2|Magnezone|
|poke|p2|Hawlucha, F|
|poke|p2|Raichu-Alola, M|
|poke|p2|Ferrothorn, M|
|poke|p2|Magearna-Original|
|poke|p1|Slowbro, M|
|poke|p1|Tangrowth, F|
|poke|p1|Crawdaunt, F|
|poke|p1|Dragapult, M|
|poke|p1|Clefable, M|
|poke|p1|Excadrill, M|
|poke|p2|Togekiss, F|
|poke|p2|Starmie|
|poke|p2|Urshifu-*, M|
|poke|p2|Amoonguss, M|
|poke|p2|Cinderace, F|
|poke|p2|Jirachi|';
preg_match_all($re, $str, $matches, PREG_SET_ORDER, 0);
// Print the entire match result
var_dump($matches);
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for PHP, please visit: http://php.net/manual/en/ref.pcre.php