0

目前,这是我拥有的 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.
4

1 回答 1

3

这里不需要正则表达式,只需使用str_replace()

$out = str_replace("£", "\n\n", $in);
于 2012-04-03T22:45:41.817 回答