start: die /^\Z/ die: 'd' number | number 'd' number number: /\d+/
In [1] := d8 Out [1] = <<MATCHED>> In [2] := 3d4 Out [2] = <<MATCHED>> In [3] := 8 d 12 Out [3] = <<MATCHED>> In [4] := 45 Out [4] = <<UNDEF>> In [5] := 4 d Out [5] = <<UNDEF>> In [6] := 3d4 3d4 Out [6] = <<UNDEF>>