Re: [PHP-WIN] Extract Path from URL

2003-01-06 Thread Ignatius Reilly
Don't use a regex: Try: $input = "http://www.test.com/path1/thisdoc.html"; ; // find last occurence of "/" $pos = strrpos( $input, "/" ) ; // extract until this position $output = substr( $input, 0, $pos - strlen( $input ) + 1 ) ; echo $output ; HTH Ignatius __

Re: [PHP-WIN] Extract Path from URL

2003-01-06 Thread Luis Moreira
Since you cannot predict the length of the string, the way I usually solve this kind o f thing is by reading the damn thing BACKWARDS. As soon as I get a slash, voilá ... - Original Message - From: "Herhuth, Ron" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, January 06, 2003