How about this:

m!^training/webcasts/webcast_data/(\d+)/(index.html|$)!


On Thu, 2007-03-01 at 14:51 -0800, Bill Moseley wrote:
> I want to match these two (not using Chained, btw):
> 
>     /training/webcasts/webcast_data/186/
>     /training/webcasts/webcast_data/186/index.html
> 
> But not this:
> 
>     /training/webcasts/webcast_data/186/foo.html
> 
> $ perl -le 'print "YES" if "training/webcasts/webcast_data/186/index.html"  
> =~  m!^training/webcasts/webcast_data/(\d+)/(index.html)?$!'
> YES
> $ perl -le 'print "YES" if "training/webcasts/webcast_data/186/"  =~  
> m!^training/webcasts/webcast_data/(\d+)/(index.html)?$!'
> YES
> $ perl -le 'print "YES" if "training/webcasts/webcast_data/186/foo.html"  =~  
> m!^training/webcasts/webcast_data/(\d+)/(index.html)?$!
> 
> 
> I tried these:
> 
>     Regex('^training/webcasts/webcast_data/(\d+)/(index.html)?$')
> 
>         matches:
>             ../186/index.html   : yes
>             ../186/foo.html     : no
>             ../186/             : no
>             ../186              : no
> 
> 
>     Regex('^training/webcasts/webcast_data/(\d+)/?(index.html)?$')
> 
>         matches:
>             ../186/index.html   : yes
>             ../186/foo.html     : yes
>             ../186/             : yes
>             ../186              : yes
> 
> 
>     Regex('^training/webcasts/webcast_data/(\d+)(/?index.html)?$')
> 
>         matches:
>             ../186/index.html   : yes
>             ../186/foo.html     : yes
>             ../186/             : yes
>             ../186              : yes
> 
> 
> 
> 


_______________________________________________
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/

Reply via email to