The code to do this can be seen in the Limit subcategory display in sidebox to one level only thread, and also in the Categories Dressing support thread, post #75.
For your case, change the code to read
ereg("_.*_.*_.*_", $box_categories_array[$i]['path'])
Bookmarks