php3-list | 199901
Date: 01/26/99
- Next message: Tommy Williams: "Re: [PHP3] regex bug?"
- Previous message: Brad Marsh: "Re: [PHP3] PHP and Excel"
- In reply to: Daniel Lashua: "Re: [PHP3] Path"
- Next in thread: Joey Smith: "Re: [PHP3] Path"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
> > Now, for the second half of the question... since I'm horrible at regex,
> > does anybody know the regular expression that will take this:
> >
> > /home2/users/whatever/
> >
> > and extract 'whatever'
$path = '/a/b/c/d/e/f/g/gimmethis/';
ereg('/?([^/]+)/?$',$path,$directory);
echo "$directory[1]<BR>";
If you know that the path will always have a leading and trailing /, then
you can remove the ?s from the pattern in ereg().
-adam
-- / adam maccabee trachtenberg | visit college life online \ \ adam <email protected> | http://www.student.com /-- PHP 3 Mailing List http://www.php.net/ To unsubscribe send an empty message to php3-unsubscribe <email protected> To subscribe to the digest list: php3-digest-subscribe <email protected> For help: php3-help <email protected> Archive: http://www.php.net/mailsearch.php3 List administrator: zeev-list-admin <email protected>
- Next message: Tommy Williams: "Re: [PHP3] regex bug?"
- Previous message: Brad Marsh: "Re: [PHP3] PHP and Excel"
- In reply to: Daniel Lashua: "Re: [PHP3] Path"
- Next in thread: Joey Smith: "Re: [PHP3] Path"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

