0

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.

1 Answer 1

3

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

$out = str_replace("£", "\n\n", $in);
Sign up to request clarification or add additional context in comments.

4 Comments

This deletes the entire lines that have £ in them.
Not for me, nor would that make sense. Here's a demo: codepad.org/oho8zhgi
Yep I even manually put the text in as the variable and it removes the whole line. here's the link to the fullcode. codepad.org/DupoYKzY
Problem was since I was pulling from an XML file that was in utf8 I had to utf8_decode it first before replacing the string.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.