Re: [PHP] Help with eregi

2004-06-22 Thread Curt Zirzow
* Thus wrote Tom Z. Meinlschmidt:
> On Tue, Jun 22, 2004 at 10:08:37PM +0300 Robin Vickery [EMAIL PROTECTED] wrote:
> > On Tue, 22 Jun 2004 14:57:28 -0400, Ryan Schefke <[EMAIL PROTECTED]> wrote:
> > > 
> > > Could someone please help me with an eregi statement.
> > > 
> > > I have a string that can vary as such:
> > > 
> > > client1/album/album_121-2132_IMG.JPG
> > > 
> > > ...
> > > 
> > > I want to select whatever comes after the last forward slash, like
> > > album_121-2132_IMG.JPG
> > 
> > preg_match('#client[[:digit:]]+/album/(album_[[:digit:]]{3}-[[:digit:]]{4}_IMG\.JPG)#i',
> > $string, $matches);
> 
> too complex.
> 
> eregi("\/([a-z0-9_-]*\.jpg)$", $string, $arg) is good enough :)

Still too complex.

basename('client1/album/album_121-2132_IMG.JPG');

Curt
-- 
Feels like he's filling Mr Holmes shoes right now :)

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



Re: [PHP] Help with eregi

2004-06-22 Thread Matt Matijevich
[snip]
client1/album/album_121-2132_IMG.JPG

client2/album/album_121-2132_IMG.JPG

client59/album/album_121-2132_IMG.JPG

client499887/album/album_121-2132_IMG.JPG

 

I want to select whatever comes after the last forward slash, like
album_121-2132_IMG.JPG
[/snip]

you could try without regular expressions

$string = 'client1/album/album_121-2132_IMG.JPG';
$arr = explode('/',$string);
print $arr[count($arr) - 1];

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



Re: [PHP] Help with eregi

2004-06-22 Thread Tom Z. Meinlschmidt
On Tue, Jun 22, 2004 at 10:08:37PM +0300 Robin Vickery [EMAIL PROTECTED] wrote:
> On Tue, 22 Jun 2004 14:57:28 -0400, Ryan Schefke <[EMAIL PROTECTED]> wrote:
> > 
> > Could someone please help me with an eregi statement.
> > 
> > I have a string that can vary as such:
> > 
> > client1/album/album_121-2132_IMG.JPG
> > 
> > client2/album/album_121-2132_IMG.JPG
> > 
> > client59/album/album_121-2132_IMG.JPG
> > 
> > client499887/album/album_121-2132_IMG.JPG
> > 
> > I want to select whatever comes after the last forward slash, like
> > album_121-2132_IMG.JPG
> 
> preg_match('#client[[:digit:]]+/album/(album_[[:digit:]]{3}-[[:digit:]]{4}_IMG\.JPG)#i',
> $string, $matches);
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

too complex.

eregi("\/([a-z0-9_-]*\.jpg)$", $string, $arg) is good enough :)

/tom

-- 
===
Tomas Meinlschmidt, SBN3, MCT, MCP, MCP+I, MCSE, NetApp Filer & NetCache
gPG fp: CB78 76D9 210F 256A ADF4 0B02 BECA D462 66AB 6F56 / $ID: 66AB6F56
GCS d-(?) s: a- C++ ULHISC*$ P+++> L+++$> E--- W+++$ N++(+) !o
!K w(---) !O !M V PS+ PE Y+ PGP++ t+@ !5 X? R tv b+ !DI D+ G e>+++
h r+++ z+++@
===

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



Re: [PHP] Help with eregi

2004-06-22 Thread Robin Vickery
On Tue, 22 Jun 2004 14:57:28 -0400, Ryan Schefke <[EMAIL PROTECTED]> wrote:
> 
> Could someone please help me with an eregi statement.
> 
> I have a string that can vary as such:
> 
> client1/album/album_121-2132_IMG.JPG
> 
> client2/album/album_121-2132_IMG.JPG
> 
> client59/album/album_121-2132_IMG.JPG
> 
> client499887/album/album_121-2132_IMG.JPG
> 
> I want to select whatever comes after the last forward slash, like
> album_121-2132_IMG.JPG

preg_match('#client[[:digit:]]+/album/(album_[[:digit:]]{3}-[[:digit:]]{4}_IMG\.JPG)#i',
$string, $matches);

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



[PHP] Help with eregi

2004-06-22 Thread Ryan Schefke
Could someone please help me with an eregi statement.

 

I have a string that can vary as such:

 

client1/album/album_121-2132_IMG.JPG

client2/album/album_121-2132_IMG.JPG

client59/album/album_121-2132_IMG.JPG

client499887/album/album_121-2132_IMG.JPG

 

I want to select whatever comes after the last forward slash, like
album_121-2132_IMG.JPG

 

Thanks,

Ryan