Re: [PHP] please help with regular expression in preg_replace

2009-10-30 Thread Red
- Original Message ----- From: "Jim Lucas" To: "Red" Cc: Sent: Friday, October 30, 2009 12:33 AM Subject: Re: [PHP] please help with regular expression in preg_replace Red wrote: hello, im not a php developer, i just need to rewrite one php file but having

Re: [PHP] please help with regular expression in preg_replace

2009-10-29 Thread Jim Lucas
Red wrote: > hello, im not a php developer, i just need to rewrite one php file but having > problem with understanding syntax of regexp in php. > > i need to get domain name from fqdn (for example from $_SERVER['HTTP_HOST'] ) > > in sed its working well with "s/[^.]*\.//" , but preg_replace beh

Re: [PHP] please help with regular expression in preg_replace

2009-10-29 Thread Andy Shellam (Mailing Lists)
Hi Rene, This looks suspiciously like regex's "greedy" behaviour - it will gobble up everything that matches until you tell it otherwise. For example, your regex is matching "any character that isn't a dot, followed by a dot." In host.domain.com, both "host." and "domain." match this rege