on 2/12/01 1:01 PM, Jason Stechschulte at [EMAIL PROTECTED] wrote:

> On Mon, Feb 12, 2001 at 12:15:04PM -0500, Jesse Swensen wrote:
>> 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.
> 
> $fix = ereg_replace("(^ )|( $)", "_", $checkme);

This is very close.  If the string, "  Testing  ", had multiple spaces, but
I wanted to convert each space to a "_", then what?  I tried:

$fix = ereg_replace("(^ +)|( +$)", "_", $checkme);

and

$fix = ereg_replace("(^[ ]+)|([ ]+$)", "_", $checkme);

with no success.

Thanks for your help...
-- 
Jesse Swensen
[EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to