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

Okay, this worked BUT I just realized I cannot rely on a space to signal a valid number. Sometimes the number starts the text field so there is no space. I'm trying to recognize only those numbers that aren't followed or proceeded by a slash, dash, etc., that would indicate a phone number or date.

Replies are listed 'Best First'.
Re^3: Recognizing 3 and 4 digit number
by tybalt89 (Monsignor) on Jan 02, 2017 at 02:54 UTC
    my $digits_4 = qr{ (?<![\/-\ \w]) \d{4} (?![\/-\ \w]) }xms;

    untested...

      This one returns the following error:
      Invalid [] range "\\/-\\ " in regex; marked by <-- HERE in m/ (?<![\\/ +-\\ <-- HERE \\w]) \\d{4} (?![\\/-\\ \\w]) /
      I'm not really sure what is wrong.

        - should be at beginning or end of []