Zugzwangle Posted August 7, 2010 Share Posted August 7, 2010 im very new to regex - does: $aVal2 = str_replace('/\{\[/', "{", $aVal); $aVal3 = str_replace('/\]\}/', "}", $aVal2); find and replace "{[" and "]}" with { and } please help if you can!! Quote Link to comment https://forums.phpfreaks.com/topic/210027-am-i-getting-my-regex-wrong/ Share on other sites More sharing options...
.josh Posted August 7, 2010 Share Posted August 7, 2010 str_replace is not regex. It matches and replaces the literal string. so you don't need delimiters or escapes. So you would do $aVal2 = str_replace('{[','{',$aVa1); Quote Link to comment https://forums.phpfreaks.com/topic/210027-am-i-getting-my-regex-wrong/#findComment-1096158 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.