Q:

regex/preg_replace to replace subdomain

i need to use preg_replace to replace two subdomain elements with a single element. my regex skills are virtually nonexistent. the urls are of the form:
user1.common.domain.org
user2.common.domain.org
something.common.domain.org
else.common.domain.org

and need to be replaced with:
newvalue.domain.org

A:

preg_replace( '/[a-z0-9]+\.common/i' , 'newvalue' , $url );

