Drupal How to use regex or specific keywords as menu arguements I have a drupal website, in which I wanted to add a new URL. This menu have two arguements which should be passed from the client side.

function campaign_management_menu() {
  $items = array();
  $items['campaign-management/test/%/%'] = array(
    'title' =&gt; 'Campaign Management',
    'description' =&gt; 'A section where you can manage your campaigns',
    'page callback' =&gt; 'cm_home',
    'page arguments' =&gt; array(3, 4),
    'access callback' =&gt; TRUE,
  );
  return $items
}


Here, for the fourth argument, there should be only two options {add/edit}. Is there any option in drupal to set these two keywords explicitely. ie,

$items['campaign-management/test/%/{add|edit}'] = array(
  'title' =&gt; 'Campaign Management',
  'description' =&gt; 'A section where you can manage your campaigns',
  'page callback' =&gt; 'cm_home',
  'page arguments' =&gt; array(3, 4),
  'access callback' =&gt; TRUE,
);
There isn't such an option; you just define two route items.

$items['campaign-management/test/%/add'] = array(
  'title' =&gt; 'Campaign Management',
  'description' =&gt; 'A section where you can manage your campaigns',
  'page callback' =&gt; 'cm_home',
  'page arguments' =&gt; array(3, 4),
  'access callback' =&gt; TRUE,
);

$items['campaign-management/test/%/edit'] = array(
  'title' =&gt; 'Campaign Management',
  'description' =&gt; 'A section where you can manage your campaigns',
  'page callback' =&gt; 'cm_home',
  'page arguments' =&gt; array(3, 4),
  'access callback' =&gt; TRUE,
);


Alternatively, you define your route as follows.

$items['campaign-management/test/%/%'] = array(
  'title' =&gt; 'Campaign Management',
  'description' =&gt; 'A section where you can manage your campaigns',
  'page callback' =&gt; 'cm_home',
  'page arguments' =&gt; array(3, 4),
  'access callback' =&gt; TRUE,
);


Your page callback then will do something when the last argument it get is 'add' or 'edit'; eventually, it can return a 404 error when the argument doesn't have one of the desired values.  

Keep in mind that in Drupal 7, a user visiting (for example) node/1/sgsdrgdfgdfe45t63635wsg will normally see the node page (node/1, in this case). To keep that behavior, you should define the campaign-management/test/%/add and campaign-management/test/%/edit routes.