- print_r: documentation ( source)
- preg_match_all: documentation ( source)
<?php
$subject = "http://directory.google.com/Category/Subcategory/Another_Subcategory";
$pattern = "directory.google.com/[A-Z][a-zA-Z_/]+$";
preg_match_all($pattern, $subject, $matches, PREG_PATTERN_ORDER);
print_r($matches);