in reply to Recognizing 3 and 4 digit number

I can't help but think there is more to this requirement than you've specifed, but based on what you've asked for, +a little bit more, try:

/\s\d{3,4}\s/ and print for 'abd 123 fred', '555-5555-6666', 'ab 12345 + xd';; abd 123 fred

With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority". The enemy of (IT) success is complexity.
In the absence of evidence, opinion is indistinguishable from prejudice.

Replies are listed 'Best First'.
Re^2: Recognizing 3 and 4 digit number
by htmanning (Friar) on Jan 02, 2017 at 01:20 UTC
    I put a backslash s in front of the backslash d and it works, but puts a percent 20 in the url. It still works but there must be another way. Thank you.

      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.
      Impossible :) nothing in that snippet does "value" encoding/escapeing