Thread:Project:Support desk/Help with code in Extension to only allow editing of Subpages

I'm butchering together a working extension that will deny editing on base pages, but allow editing on subpages 3+ deep. So pages "Country" and "Country/State" are NOT editable, but pages "Country/State/City" and "Country/State/City/Street" are editable. By piecing together extensions, I managed to get this working great, except completely opposite of the way I want it to (basepages editable, subpages aren't). Could some one help me correct the if statement or regex to get this working right? I'd also like to add an exception for sysops to be allowed editing of everything. Thanks function efExtensionBlockSubpages($title, $user, $action, $result) { global $egRegexMatch; if ($action == 'edit') { $egRegexMatch[NS_MAIN][] = "!^(.+/.+/.*)$!"; $pageTitle = $title->getText; $pageNs = $title->getNamespace; if (array_key_exists($pageNs, $egRegexMatch)) { foreach ($egRegexMatch[$pageNs] as $pattern) { if (preg_match($pattern, $pageTitle))	{ $result = true; return false; }			}		}	}	   return true; }