0

I am trying to replace every instance of:

{{anythinghere::anythingthere}} 

in a string.

Any help would be appreciated

3
  • and what do you want to replace them with? Commented Oct 11, 2011 at 16:07
  • Assuming the rest are literal characters, define anything. Also answer Spudley's question. Commented Oct 11, 2011 at 16:07
  • replace what with what? Give me example string and the desired result Commented Oct 11, 2011 at 16:08

1 Answer 1

3

As you didn't specify what you want to replace it with:

preg_replace("/{{([^:}]+)::([^:}]+)}}/", "First_param: $1, Second_param: $2", $target_string);

This would return First_param: anythinghere, Second_param: anythingthere.

Sign up to request clarification or add additional context in comments.

Comments

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.