spires Posted September 3, 2012 Share Posted September 3, 2012 Hi I have a string that is pulled from a database. I want to remove the title, but not sure how I do it. I was trying something like this: $string = '<strong>Dynamic Title, so will be different on every loop</strong> Rest of text etc'; $newString = preg_replace('<strong>[^A-Za-z0-9_-]+</strong><br />', '', $string); Any ideas? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/267968-string-replace/ Share on other sites More sharing options...
scootstah Posted September 3, 2012 Share Posted September 3, 2012 $string = '<strong>Dynamic Title, so will be different on every loop</strong> Rest of text etc'; $newString = preg_replace('/<strong>(.*?)<\/strong>/si', '', $string); Quote Link to comment https://forums.phpfreaks.com/topic/267968-string-replace/#findComment-1374967 Share on other sites More sharing options...
spires Posted September 3, 2012 Author Share Posted September 3, 2012 Perfect Thanks Quote Link to comment https://forums.phpfreaks.com/topic/267968-string-replace/#findComment-1374968 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.