If a ports subdir is followed by either a flavor or a subpackage name it will be delimited by a comma. So let the regex matching the subdir include everything but not a comma.
@@ -395,7 +395,7 @@ sub create_package_information {
if ($pkg =~ m/^
([a-z][a-z0-9]*)\/
([A-Za-z][\.A-Za-z0-9-+_]*)
- ((\/[a-z0-9._-]*)*)?
+ ((\/[^,]*)*)?
$regex_subpkg
$regex_flavor/x) {
$category = $1;