Re: strip slashes from beginning and end of string in one expression

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Dave M G wrote:
This is another regular expression type of question.

The very handy PHP function trim() takes excess white space off the beginning and end of a string.

I'd like to be able to do the same thing, except instead of white spaces, trim excess slashes: /

So for example, all of these:
/this/that/
/this/that
this/that/
////////this/that////////////

... become:
this/that

Why do people insist on over-complicating things with regexes? They're not the best tool for every job!

Read the manual page for the trim function (http://php.net/trim) and try using the second parameter.

-Stut

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux