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 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); 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 Link to comment https://forums.phpfreaks.com/topic/267968-string-replace/#findComment-1374968 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.