Justin Lucas
Justin Lucas

Reputation: 319

Replace character with another character in regex PHP

currently, this is the preg_replace string that I have.

$mtg_post['post_content'] = preg_replace("[^\\x20-\\x7e]", "",$ability);

This is an example of the data contained within $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? 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.

Upvotes: 0

Views: 799

Answers (1)

Cal
Cal

Reputation: 7157

No need for a regexp here, just use str_replace():

$out = str_replace("£", "\n\n", $in);

Upvotes: 3

Related Questions