I have a string like this "{text}...{text}...{text}...text..." I need to replace the "text" value in the string but only the ones that are not in curl开发者_StackOverflowy or square brackets
You should then use regular expressions :
/(?<!({|\[))text(?!(}|\]]))/
You can use this with preg_replace() :
preg_replace("/(?<!({|\[))text(?!(}|\]]))/", $replace, $string);
精彩评论