On Solaris 11.4, if you set your PATH variable correctly to pick up the command line tools that are slightly more usable than the default set, then you would be able to use
grep -E -v 'foo|bar' file
You get this more capable grep as your default grep if you set your PATH like so:
PATH=$(/usr/xpg6/bin/getconf PATH):$PATH
This would add the following paths to the front of your existing PATH variable's value, on a default Solaris 11.4 system:
/usr/xpg6/bin:/usr/xpg4/bin:/usr/bin:/opt/developerstudio12.5/bin:/opt/solarisstudio12.4/bin
See also man standards on a Solaris system.
-vflag is a negation.not(A or B) == not(A) and not(B)