Re: Checking file extensions
| From: | Ignacio Vazquez-Abrams | Date: | Fri, 05 Jan 2001 16:45:56 +0000 |
| Subject: | Re: Checking file extensions | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-32900@lists.php.net to get a copy of this message | ||
On Fri, 5 Jan 2001, Ben Wiechman wrote:
> Alright, what I'm trying to do is index my site and build a list of files,
> but I only want files with certain extensions to be indexed and I'm having
> some wierd results.
>
> When I use (where $entry is a file name)
> if( ereg( "\.html$", $entry ) )
> Everything works great, and only files with the html extension are included
> in my list. But as soon as I add more file types, for example
> if( ereg( "[\.html|\.htm]$", $entry ) )
> as my condition allows files with types .htm, .html, .js, .shtml, .shtm, and
> more through to be put in the list.
>
> Can anyone see something wrong with my re?
>
> Thanks for the help.
>
> Ben
>
Whoops.
"(\.html|\.htm)$"
The square brackets are for characters.
--
Ignacio Vazquez-Abrams <ignacio@openservices.net>