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 Quote 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] Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.