Consider this string:
foo{This is my inner content. Hello}
What I want to do with regex is make it so it becomes like this:
This is my inner content. Hello
Note that I only want to match foo{ and }, when put together and used like that. I don't want, for example, foo2{ and }.
Is there a way?
Use:
$str = preg_replace('/foo\{([^}]*)\}/', '$1', $str);
Seems pretty simple:
/foo{(.*?)}/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With