in reply to Re^2: Recognizing 3 and 4 digit number
in thread Recognizing 3 and 4 digit number

If you don't want the space in the substitution, don't include it in the capture group!

$ perl -E' my $re = qr/ \s ( \d{3,4} ) /x; say ">$1<" if " 5678" =~ /$re/; ' >5678<


The way forward always starts with a minimal test.