dagnasty Posted July 3, 2006 Share Posted July 3, 2006 So let's say I have this string:[Movies - Comedy] The Funny Movie [DVD]and I want to remove first occurance of ] and everything before it, how would I go about doing it so that it leaves me The Funny Movie [DVD] ?strstr leaves the ] behind Link to comment https://forums.phpfreaks.com/topic/13576-removing-the-character-and-everything-before-it-in-its-first-occurance/ Share on other sites More sharing options...
effigy Posted July 3, 2006 Share Posted July 3, 2006 [code]<?php $string = '[Movies - Comedy] The Funny Movie [DVD]'; echo $string = preg_replace('/^[^]]+\]\s*/', '', $string);?>[/code] Link to comment https://forums.phpfreaks.com/topic/13576-removing-the-character-and-everything-before-it-in-its-first-occurance/#findComment-52600 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.