-1

How do I remove {SEP}, date, name, colon(:) from this $string using php ?

$string = "{SEP}09-27-2014 19:38 PM alex : hmm..{SEP}{SEP}09-27-2014 20:04 PM alex : note here..{SEP}{SEP}09-27-2014 20:05 PM alex : testing{SEP}
{SEP}09-27-2014 20:07 PM alex : 1{SEP}{SEP}09-27-2014 20:29 PM alex : abc{SEP}{SEP}09-27-2014 20:30 PM alex : nice..{SEP}{SEP}09-27-2014 
20:32 PM alex : checking by pressing the save button.{SEP}{SEP}09-27-2014 20:32 PM alex : Ok now check without save button.{SEP}";

so that it will be look like this :

hmm.. note here..testing 1 abc nice..checking by pressing the save button. Ok now check 
without save button.
3
  • please provide full code.. Commented Oct 3, 2014 at 12:32
  • stackoverflow.com/questions/4455821/… Commented Oct 3, 2014 at 12:34
  • look on this website for preg_replace Commented Oct 3, 2014 at 12:36

1 Answer 1

1

preg_replace would be a good place to start:

echo preg_replace("/\{SEP\}(.+?)\s:\s(.+?)\{SEP\}/m", "$2", $string);
Sign up to request clarification or add additional context in comments.

2 Comments

seems not working. It's not remove the specific text like {SEP}, date, name and colon.
It works for me and my output is hmm..note here..testing1abcnice..checking by pressing the save button.Ok now check without save button.

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.