[英]Replace character with another character in regex PHP
currently, this is the preg_replace string that I have.目前,这是我拥有的 preg_replace 字符串。
$mtg_post['post_content'] = preg_replace("[^\\x20-\\x7e]", "",$ability);
This is an example of the data contained within $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.
I want to replace the £ character with 2xreturn or new paragraph?我想用 2xreturn 或新段落替换 £ 字符? in regex so the line will look like this but not quite sure how to implement this.
在正则表达式中所以该行看起来像这样但不太确定如何实现它。
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.
No need for a regexp here, just use str_replace()
:这里不需要正则表达式,只需使用
str_replace()
:
$out = str_replace("£", "\n\n", $in);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.