我有这个代码来替换每个数字(和点)并将其替换为<b>and the text</b>
<?
function reem2($cadena) {
$buscarRegex = array('/^([0-9]{1}|[.])$/i');
$reemplazo = array('<b>$i</b>');
$mag = preg_replace($buscarRegex, $reemplazo, $cadena);
return $cadena;
}
$string = "1. Krewella - Can't Control Myself
2. Kdrew - Circles
3. Korn Feat. Skrillex & Kill The Noise - Narcissistic Cannibal
4. Netsky - Love Has Gone
5. Example - Midnight Run (Flux Pavilion Remix)
6. Madeon - Finale (Radio Version)
7. Feed Me Vs. Knife Party Vs. Skrillex - My Pink Reptile Party (Maluu's Slice'n'diced Mashup)
8. Krewella & Pegboard Nerds - This Is Not The End
9. Skrillex - Bangarang
10. The Prototypes - Suffocate
11. Ayah Marar - Mind Controller (Cutline Remix)
12. Skrillex Feat. Krewella - Breathe (Vocal Edit)
13. Utah Saints Vs. Drumsound & Bassline Smith - What Can You Do For Me (Tantrum Desire Remix)
14. Nero - Promises (Skrillex & Nero Remix)
15. 20 Florence & The Machine - Cosmic Love (Seven Lions Remix)";
echo reem2(nl2br($string));
?>
但它不起作用,它不会改变任何东西:
HTML 中的输出将是:
1. Krewella - 无法控制自己
2. Kdrew - 圈子
3. Korn 壮举。Skrillex & Kill The Noise - 自恋的食人族
4. Netsky - 爱已逝去
5.示例 - Midnight Run (Flux Pavilion Remix)
6. Madeon - Finale (电台版)
7.喂我VS。刀党VS。Skrillex - 我的粉红爬行动物派对(Maluu's Slice'n'diced Mashup)
8. Krewella & Pegboard Nerds - 这不是结束
9. Skrillex - 班加朗
10.原型-窒息
11. Ayah Marar - Mind Controller (Cutline Remix)
12. Skrillex 壮举。Krewella - 呼吸(人声编辑)
13.犹他州圣徒队 Drumsound & Bassline Smith - What Can You Do For Me (Tantrum Desire Remix)
14. Nero - Promises (Skrillex & Nero Remix)
15. 20 Florence & The Machine - Cosmic Love (七狮混音)
我能做些什么?