Index: server/core.c
===================================================================
--- server/core.c	(revision 1663123)
+++ server/core.c	(working copy)
@@ -2200,6 +2200,7 @@
     char *old_path = cmd->path;
     core_dir_config *conf;
     ap_conf_vector_t *new_dir_conf = ap_create_per_dir_config(cmd->pool);
+    const char *regex;
     ap_regex_t *r = NULL;
     const command_rec *thiscmd = cmd->cmd;
 
@@ -2223,15 +2224,20 @@
 
     if (!strcmp(cmd->path, "~")) {
         cmd->path = ap_getword_conf(cmd->pool, &arg);
-        if (!cmd->path)
-            return "<Directory ~ > block must specify a path";
-        r = ap_pregcomp(cmd->pool, cmd->path, AP_REG_EXTENDED|USE_ICASE);
+        if (!*cmd->path) {
+            return "<Directory ~ > block must specify a regex";
+        }
+        regex = ap_getword_conf(cmd->pool, &arg);
+        r = ap_pregcomp(cmd->pool, *regex ? regex : cmd->path,
+                AP_REG_EXTENDED | USE_ICASE);
         if (!r) {
             return "Regex could not be compiled";
         }
     }
     else if (thiscmd->cmd_data) { /* <DirectoryMatch> */
-        r = ap_pregcomp(cmd->pool, cmd->path, AP_REG_EXTENDED|USE_ICASE);
+        regex = ap_getword_conf(cmd->pool, &arg);
+        r = ap_pregcomp(cmd->pool, *regex ? regex : cmd->path,
+                AP_REG_EXTENDED | USE_ICASE);
         if (!r) {
             return "Regex could not be compiled";
         }
@@ -2284,8 +2290,8 @@
     ap_add_per_dir_conf(cmd->server, new_dir_conf);
 
     if (*arg != '\0') {
-        return apr_pstrcat(cmd->pool, "Multiple ", thiscmd->name,
-                           "> arguments not (yet) supported.", NULL);
+        return apr_pstrcat(cmd->pool, "Additional ", thiscmd->name,
+                           "> arguments not (yet) supported: ", arg, NULL);
     }
 
     cmd->path = old_path;
@@ -2301,6 +2307,7 @@
     int old_overrides = cmd->override;
     char *old_path = cmd->path;
     core_dir_config *conf;
+    const char *regex;
     ap_regex_t *r = NULL;
     const command_rec *thiscmd = cmd->cmd;
     ap_conf_vector_t *new_url_conf = ap_create_per_dir_config(cmd->pool);
@@ -2323,14 +2330,21 @@
     cmd->override = OR_ALL|ACCESS_CONF;
 
     if (thiscmd->cmd_data) { /* <LocationMatch> */
-        r = ap_pregcomp(cmd->pool, cmd->path, AP_REG_EXTENDED);
+        regex = ap_getword_conf(cmd->pool, &arg);
+        r = ap_pregcomp(cmd->pool, *regex ? regex : cmd->path,
+                AP_REG_EXTENDED);
         if (!r) {
             return "Regex could not be compiled";
         }
     }
     else if (!strcmp(cmd->path, "~")) {
         cmd->path = ap_getword_conf(cmd->pool, &arg);
-        r = ap_pregcomp(cmd->pool, cmd->path, AP_REG_EXTENDED);
+        if (!*cmd->path) {
+            return "<Location ~ > block must specify a regex";
+        }
+        regex = ap_getword_conf(cmd->pool, &arg);
+        r = ap_pregcomp(cmd->pool, *regex ? regex : cmd->path,
+                AP_REG_EXTENDED);
         if (!r) {
             return "Regex could not be compiled";
         }
@@ -2356,8 +2370,8 @@
     ap_add_per_url_conf(cmd->server, new_url_conf);
 
     if (*arg != '\0') {
-        return apr_pstrcat(cmd->pool, "Multiple ", thiscmd->name,
-                           "> arguments not (yet) supported.", NULL);
+        return apr_pstrcat(cmd->pool, "Additional ", thiscmd->name,
+                           "> arguments not (yet) supported: ", arg, NULL);
     }
 
     cmd->path = old_path;
@@ -2373,6 +2387,7 @@
     int old_overrides = cmd->override;
     char *old_path = cmd->path;
     core_dir_config *conf;
+    const char *regex;
     ap_regex_t *r = NULL;
     const command_rec *thiscmd = cmd->cmd;
     ap_conf_vector_t *new_file_conf = ap_create_per_dir_config(cmd->pool);
@@ -2400,14 +2415,18 @@
     }
 
     if (thiscmd->cmd_data) { /* <FilesMatch> */
-        r = ap_pregcomp(cmd->pool, cmd->path, AP_REG_EXTENDED|USE_ICASE);
+        regex = ap_getword_conf(cmd->pool, &arg);
+        r = ap_pregcomp(cmd->pool, *regex ? regex : cmd->path,
+                AP_REG_EXTENDED | USE_ICASE);
         if (!r) {
             return "Regex could not be compiled";
         }
     }
     else if (!strcmp(cmd->path, "~")) {
         cmd->path = ap_getword_conf(cmd->pool, &arg);
-        r = ap_pregcomp(cmd->pool, cmd->path, AP_REG_EXTENDED|USE_ICASE);
+        regex = ap_getword_conf(cmd->pool, &arg);
+        r = ap_pregcomp(cmd->pool, *regex ? regex : cmd->path,
+                AP_REG_EXTENDED | USE_ICASE);
         if (!r) {
             return "Regex could not be compiled";
         }
@@ -2443,8 +2462,8 @@
     ap_add_file_conf(cmd->pool, (core_dir_config *)mconfig, new_file_conf);
 
     if (*arg != '\0') {
-        return apr_pstrcat(cmd->pool, "Multiple ", thiscmd->name,
-                           "> arguments not (yet) supported.", NULL);
+        return apr_pstrcat(cmd->pool, "Additional ", thiscmd->name,
+                           "> arguments not (yet) supported: ", arg, NULL);
     }
 
     cmd->path = old_path;
@@ -2530,8 +2549,8 @@
         return errmsg;
 
     if (*arg != '\0') {
-        return apr_pstrcat(cmd->pool, "Multiple ", thiscmd->name,
-                           "> arguments not supported.", NULL);
+        return apr_pstrcat(cmd->pool, "Additional ", thiscmd->name,
+                           "> arguments not supported: ", arg, NULL);
     }
 
     cmd->path = old_path;
