[nycphp-talk] preg_replace to extract a domain name?

webmaster at webmaster at
Sat Aug 1 12:17:58 EDT 2009

Hello NYPHP,

I am using preg_replace to try to extract the domain name of one of my
sites so that I can use it as a variable. It has a standard http
format, i.e. and I am trying to get only
"mydomain" from it.

I have something that works but it does multiple tests before it
generates the variable I need. I thinking that the multiple lines
ought to be combined into a single statement that does the job on one
fell swoop. Am I right in assuming this can be done in one line of

TIA for any pointers.

Best regards,
 webmaster                          mailto:webmaster at

More information about the talk mailing list