By placing part of a regular expression inside round brackets or parentheses ( and ), you can group that part of the regular expression together.
In previous example the regexp won't match /dev/tty0p0 and /dev/ttyS0. To fix this use the following regex:
egrep '/dev/(([a-z]|[A-Z])*[0-9]?)*' /etc/sane.d/dc25.conf
Output:
port=/dev/ttyS0
#port=/dev/ttyd1
#port=/dev/tty0p0
#port=/dev/tty01