or download this
my $number = qr#(-?\d+\.?\d*)#;
my $mixNmatch = qr#(?:(?:\s+[d][a-z]*\s+$number)|(?:\s+[oa][a-z]*\s+$n
+umber))*#;
while ($_ = <>)
...
no warnings; # dealing with undefs is clutter for this example
print /^lock$mixNmatch\s*$/i ? "Yes: disp=$1, offset=$2\n" : "nope\n
+";
}