GHopkins
GHopkins

Reputation: 1

PHP preg_replace string text

I am trying to replace every instance of:

{{anythinghere::anythingthere}} 

in a string.

Any help would be appreciated

Upvotes: 0

Views: 497

Answers (1)

Kaivosukeltaja
Kaivosukeltaja

Reputation: 15735

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.

Upvotes: 3

Related Questions