Re: strip slashes from beginning and end of string in one expression
| From: | Stut | Date: | Thu, 31 Aug 2006 08:36:16 +0000 |
| Subject: | Re: strip slashes from beginning and end of string in one expression | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-241270@lists.php.net to get a copy of this message | ||
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/thatWhy 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