<?php $re = '~/([^/]+)~'; $str = "/test:n(0-2)/div/"; preg_match_all($re, $str, $matches);print_r($matches[1]);
Standard input is empty
Array ( [0] => test:n(0-2) [1] => div )
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!