Reputation: 1
I am trying to replace every instance of:
{{anythinghere::anythingthere}}
in a string.
Any help would be appreciated
Upvotes: 0
Views: 497
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