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 に答える