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)
 [EMAIL PROTECTED]
 www.phpbeginner.com




-----Original Message-----
From: Jesse Swensen [mailto:[EMAIL PROTECTED]]
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
[EMAIL PROTECTED]

> From: "PHPBeginner.com" <[EMAIL PROTECTED]>
> Date: Tue, 13 Feb 2001 03:25:59 +0900
> To: "Jesse Swensen" <[EMAIL PROTECTED]>, <[EMAIL PROTECTED]>
> Subject: RE: [PHP] Regex help needed...
>
> rtrim()
>
> www.php.net/rtrim
>
>
> Sincerely,
>
> Maxim Maletsky
> Founder, Chief Developer
>
> PHPBeginner.com (Where PHP Begins)
> [EMAIL PROTECTED]
> www.phpbeginner.com
>
>
>
>
>
> -----Original Message-----
> From: Jesse Swensen [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, February 13, 2001 2:15 AM
> To: [EMAIL PROTECTED]
> 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
> [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]
>
>
>



-- 
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