In sed everything needs to be escaped. If I want to find 5 occurences: {5} in sed must be written as \{5\}
also the pattern for printing needs escaping \(…\)
An example for finding exactly 5 numbers in a row with sed (and print them).
$ echo 'ABCD12345EFGH' | sed -e 's/.*\([0-9]\{5\}\)/\1/g' 12345
.