<?php$s = "world:region:bash";$p = "/:[^:]+$/";$r = ''; echo preg_replace($p, $r, $s);
Standard input is empty
world:region
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!