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<
In reply to Re^3: Recognizing 3 and 4 digit number
by 1nickt
in thread Recognizing 3 and 4 digit number
by htmanning
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |