RE: [PHP] Regex help needed...

From: Date: Tue, 13 Feb 2001 14:33:45 +0000
Subject: RE: [PHP] Regex help needed...
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-39416@lists.php.net to get a copy of this message
try ereg_replace("^[ ]+(.)[ ]+$", '_\\1_', $here) I haven't tested it, but if it won't work, then do this: $here = ereg_replace("^[ ]+", '_', $here) $here = ereg_replace("[ ]$", '_', $here) this should work... Sincerely, Maxim Maletsky Founder, Chief Developer PHPBeginner.com (Where PHP Begins) maxim@phpbeginner.com www.phpbeginner.com -----Original Message----- From: Jesse Swensen [mailto:swensenj@bellsouth.net] Sent: Tuesday, February 13, 2001 4:39 AM To: PHPBeginner.com Subject: Re: [PHP] Regex help needed... Thank you for your suggest, but I don't want to just trim them, I need to display them as underscores (_). -- Jesse Swensen swensenj@bellsouth.net > From: "PHPBeginner.com" <php-general@phpbeginner.com> > Date: Tue, 13 Feb 2001 03:25:59 +0900 > To: "Jesse Swensen" <swensenj@bellsouth.net>, <php-general@lists.php.net> > Subject: RE: [PHP] Regex help needed... > > rtrim() > > www.php.net/rtrim > > > Sincerely, > > Maxim Maletsky > Founder, Chief Developer > > PHPBeginner.com (Where PHP Begins) > maxim@phpbeginner.com > www.phpbeginner.com > > > > > > -----Original Message----- > From: Jesse Swensen [mailto:swensenj@bellsouth.net] > Sent: Tuesday, February 13, 2001 2:15 AM > To: php-general@lists.php.net > Subject: [PHP] Regex help needed... > > > This should be a quick one, but I can't seem to wrap my brain around it. > All I need to do is replace leading or trailing spaces with underscores. If > there is spaces in between words, leave them alone. > > Suggestions? > > -- > Jesse Swensen > swensenj@bellsouth.net > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net > > >

« previous php.general (#39416) next »