[英]Replace character with another character in regex PHP
目前,這是我擁有的 preg_replace 字符串。
$mtg_post['post_content'] = preg_replace("[^\\x20-\\x7e]", "",$ability);
這是 $ability 中包含的數據示例。
At the beginning of your upkeep, put a doom counter on Armageddon Clock.£At the
beginning of your draw step, Armageddon Clock deals damage equal to the number
of doom counters on it to each player.£{4}: Remove a doom counter from Armageddon
Clock. Any player may activate this ability but only during any upkeep step.
我想用 2xreturn 或新段落替換 £ 字符? 在正則表達式中所以該行看起來像這樣但不太確定如何實現它。
At the beginning of your upkeep, put a doom counter on Armageddon Clock.
At the beginning of your draw step, Armageddon Clock deals damage equal
to the number of doom counters on it to each player.
{4}: Remove a doom counter from Armageddon Clock. Any player may activate
this ability but only during any upkeep step.
這里不需要正則表達式,只需使用str_replace()
:
$out = str_replace("£", "\n\n", $in);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.