Take a look at the grep man page. Perl added many regular expression extensions that were not in the original specification. However, since they have proven so useful, many programs have adopted them.
Unfortunately, grep sometimes gets stuck in the past because you want your grep remain compatible with older grep versions.
Some systems have egrep with some extensions. Others allow you to use grep -E to get them. The rest have grep -P , which allows you to use Perl extensions. I believe that the grep command for Linux systems can use the -P extension, which is not available on most Unix systems, unless someone has replaced grep with the GNU version. Newer versions of Mac OS X also support the -P switch, but not older versions.
source share