sandozlabz Posted July 17, 2008 Share Posted July 17, 2008 What expression do you use for preg_replace to remove "[" and "]" in a string, for example: The [boy] walked for 10 miles. so that it becomes: The boy walked for 10 miles. thanks in advance! Link to comment https://forums.phpfreaks.com/topic/115269-solved-preg_replace-to-replace-quotquot-and-quotquot-in-a-string/ Share on other sites More sharing options...
effigy Posted July 17, 2008 Share Posted July 17, 2008 Why not use str_replace? Any time you need to match a metacharacter, escape it. Link to comment https://forums.phpfreaks.com/topic/115269-solved-preg_replace-to-replace-quotquot-and-quotquot-in-a-string/#findComment-592668 Share on other sites More sharing options...
sandozlabz Posted July 17, 2008 Author Share Posted July 17, 2008 ahhh!! i was making more complicated than it needed to be thanks! Link to comment https://forums.phpfreaks.com/topic/115269-solved-preg_replace-to-replace-quotquot-and-quotquot-in-a-string/#findComment-592680 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.