I have problems with preg_replace here is the code $thing='bla |block| text here |/block| text here'; echo preg_replace('/\|block\|.*[^\/b].*\|\/block\|/i','',$thing); //prints bla |block| text here |/block| text here Code (markup): it prints the same means no match found I want to replace |block|anything|block| with '' Any help pls?