in reply to Regex to match 20 chars of some digits followed by some spaces
And the output is exactly as expected -use strict; use warnings; while (<DATA>) { chomp; print m/(\d{1,20})(??{' ' x (20 - length($1))})/ ? "match\n" : "not match\n"; } __DATA__ " 123451234512345" " 123451234512345 " "123451234512345 " "1234512345 " "123 451 2345 " " "
not match not match match match not match not match
|
|---|