[thelist] PHP - wildcard with stristr()

Hans Zaunere zaunere at yahoo.com
Sat Mar 23 20:49:01 CST 2002


You probably want to use regular expressions
(php.net/regex and php.net/pcre).

In this case, you could also probably use strcmp().
(php.net/strcmp)

HZ




--- Bill Haenel <bill at webmarketingworx.com> wrote:
> >     | if (
> >     |           $file != "."
> >     |      and  $file != ".."
> >     |      and  stristr("$searchstring", $file)
> >     |    )
> >
> >
> > This IF condition sounds ok to me, do you find
> that this is not working?
> > If not, can you give an example of a string from
> which STRISTR doesn't
> > recognize your wildcard pattern?
>
> Say I have files named 'news020303a.ram',
> 'news020303b.ram', etc. I want
> this script to find everything that matches criteria
> 'news020303*.ram', '*'
> being the wildcard.
>
> When I use 'news020303*.ram' as a search criteria
> ($searchstring in the
> above example) I get nothing, assumably because the
> '*' is interpreted as
> part of the string, not as a wildcard(and as it
> should be, I guess).
>
> Perhaps I need to split $searchstring when the '*'
> character is found and
> look for both pieces of the string that are sitting
> on either side of the
> '*'? Like split $searchstring into $ss_a and $ss_b
> at the '*' and then do:
>
> if (stristr("$ss_a", $file) and stristr("$ss_b",
> $file)) {...
>
> ???
>
> BH
>
> --
> For unsubscribe and other options, including
> the Tip Harvester and archive of thelist go to:
> http://lists.evolt.org Workers of the Web, evolt !


__________________________________________________
Do You Yahoo!?
Yahoo! Movies - coverage of the 74th Academy Awards®
http://movies.yahoo.com/



More information about the thelist mailing list