First, ls | xargs grep 'pattern' makes grep look for occurrences in
contents of files listed by ls, not in list of filenames. To look for
filenames it should be enough to do:
ls | grep 'pattern'
Second, grep '\d{11}-\d\.(?:json|pdf)' would work only with GNU grep
and -P option. Use the following syntax instead - it works with GNU,
busybox and FreeBSD implementations of grep:
ls | grep -E '[[:digit:]]{11}-[[:digit:]]\.(json|pdf)'
Third, parsing ls is not a good
idea. Use
GNU find:
find . -maxdepth 1 -regextype egrep -regex '.*/[[:digit:]]{11}-[[:digit:]]\.(json|pdf)'
or FreeBSD find:
find -E . -maxdepth 1 -regex '.*/[[:digit:]]{11}-[[:digit:]]\.(json|pdf)'