I have the following text and want to replace all instace which begin and end with ##, how can i prepare regular expression for preg_replace php.
Example
We are encountering a problem ##anytext## and will update you soon
regarding this problem ##textsomethingelse##
My question how can i replace all instance of ##anytext## with specific text?
You probably need to use
preg_replace_callbackfor this task.And an example:
Note: This example uses
create_function, but if you’re on PHP >= 5.3 you’re better of using a closure.