Index: /trunk/DNSDB.pm
===================================================================
--- /trunk/DNSDB.pm	(revision 740)
+++ /trunk/DNSDB.pm	(revision 741)
@@ -1655,6 +1655,12 @@
     my ($c) = ($$tmpl =~ /(\%-?c)/);  my $nld = '';  my $cld = '';
     $c = '' if !$c;
+    my ($cn) = ($$tmpl =~ /(\%x)/);
     my $skipgw = ($c =~ /\%-c/ ? 0 : 1);
     my $ipkill = 0;
+
+    if ($cn) {
+      # "natural n'th IP in the block" pattern
+      $$tmpl =~ s/$cn/$ipindex+1/e;
+    }
 
 ##fixme: still have one edge case not handled well:
Index: /trunk/reverse-patterns.html
===================================================================
--- /trunk/reverse-patterns.html	(revision 740)
+++ /trunk/reverse-patterns.html	(revision 741)
@@ -138,4 +138,52 @@
             </td>
           </tr>
+          <tr class="row0">
+            <td>n'th natural IP</td>
+            <td>%x</td>
+            <td>
+              customer-%3d-%x.example.com<br />
+              192.168.23.40 -> customer-23-1.example.com<br />
+              192.168.23.41 -> customer-23-2.example.com<br />
+              192.168.23.42 -> customer-23-3.example.com<br />
+              192.168.23.43 -> customer-23-4.example.com<br />
+              192.168.23.44 -> customer-23-5.example.com<br />
+              192.168.23.45 -> customer-23-6.example.com<br />
+              192.168.23.46 -> customer-23-7.example.com<br />
+              192.168.23.47 -> customer-23-8.example.com
+            </td>
+          </tr>
+          <tr class="row1">
+            <td colspan="3">Results may be exciting when combined with other patterns.
+          </tr>
+          <tr class="row0">
+            <td>n'th natural IP</td>
+            <td>%x</td>
+            <td>
+              customer-23-%x.example.com<br />
+              192.168.23.40 -> customer-23-1.example.com<br />
+              192.168.23.41 -> customer-23-2.example.com<br />
+              192.168.23.42 -> customer-23-3.example.com<br />
+              192.168.23.43 -> customer-23-4.example.com<br />
+              192.168.23.44 -> customer-23-5.example.com<br />
+              192.168.23.45 -> customer-23-6.example.com<br />
+              192.168.23.46 -> customer-23-7.example.com<br />
+              192.168.23.47 -> customer-23-8.example.com
+            </td>
+          </tr>
+          <tr class="row0">
+            <td>n'th natural IP</td>
+            <td>%x</td>
+            <td>
+              customer-23-%x.example.com<br />
+              192.168.23.40 -> customer-23-1.example.com<br />
+              192.168.23.41 -> customer-23-2.example.com<br />
+              192.168.23.42 -> customer-23-3.example.com<br />
+              192.168.23.43 -> customer-23-4.example.com<br />
+              192.168.23.44 -> customer-23-5.example.com<br />
+              192.168.23.45 -> customer-23-6.example.com<br />
+              192.168.23.46 -> customer-23-7.example.com<br />
+              192.168.23.47 -> customer-23-8.example.com
+            </td>
+          </tr>
         </tbody>
       </table>
