fork download
  1. #!/bin/bash
  2. s="ACB 01900 X1911D 1910 1955-2011 3424 2135 1934 foobar"
  3. grep -Po '^(?:.*\s)?\K(?:19\d{2}|20(?:[0-4]\d|50))(?!\S)' <<< "$s"
Success #stdin #stdout 0s 19632KB
stdin
Standard input is empty
stdout
1934