Regexp syntax

POSIX BRE and POSIX ERE syntaxes are not working.
So how can i create an analogue of this perl regexp (?:www.)?(?:.+.)?yyy.zzz
to match all of these strings:
http://www.subdomain1.yyy.zzz
http://www.subdomain2.yyy.zzz
http://www.subdomain3.yyy.zzz
subdomain1.yyy.zzz
subdomain2.yyy.zzz
subdomain3.yyy.zzz
http://www.yyy.zzz
yyy.zzz