@kumar303
grep doesn't support matching groups without the -P option and this option is not available on all Distros by default
.
I also tried using the `-E` in Linux instead of the `-r`, It works too, but it is not a documented flag ( I see no `-E` flag under `man sed` ) and I am not sure if this will work on other Distros/Builds etc.

I used the Bash Builtin regex to make it cross platform (Bash 3.0 and greater) I hope it works on a mac, I haven't been able to test it on one yet though.

If you are aware of any problems with the Bash Builtin regex (Compatibility issues) please inform me and I'll try porting this to python!