fnmatch() is not working ...

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Ruby Tuesdays

    #1

    fnmatch() is not working ...

    in win32 installation... is it compiled with it or this is a missing
    features? Thanks


  • Pedro Graca

    #2
    Re: fnmatch() is not working ...

    Ruby Tuesdays wrote:[color=blue]
    > in win32 installation... is it compiled with it or this is a missing
    > features? Thanks[/color]



    <quote>
    *Warning*

    For now this function is not available on Windows or other non-POSIX
    compliant systems.
    </quote>
    --
    --= my mail box only accepts =--
    --= Content-Type: text/plain =--
    --= Size below 10001 bytes =--

    Comment

    • Ruby Tuesdays

      #3
      Re: fnmatch() is not working ...

      Thanks Pedro, what's the alternative?

      imagename can be of the following:

      A.bmp
      A.tiff
      A dark.tif
      A lite.bmp
      AB.jpg
      AB.tif
      BB.bmp
      BB.jpg
      BB.png
      BB topleft.png
      BB topleft.jpg
      GA.png
      GA cropped.gif
      GA cropped.jpg
      BB lowerright.jpg
      BB lowerright.gif
      etc...

      If I know full/partial name(First of 1-2 characters) of the image name, and
      the type could be in the following(1st one is the highest priority): png,
      jpg, bmp, tif, gif

      if exist <fullname>.pn g then display image
      else if exist <fullname>.jp g then display image
      else if exist <fullname>.bm p then display image
      else if exist <fullname>.ti f then display image
      else if exist <fullname>.gi f then display image
      else if exist <first match of partial name>.png then display image
      else if exist <first match of partial name>.jpg then display image
      else if exist <first match of partial name>.bmp then display image
      else if exist <first match of partial name>.tif then display image
      else if exist <first match of partial name>.gif then display image
      else display no-image.jpg

      How do I search a directory efficiently(sub-folder search would be nice but
      not necessary for now).

      Thanks.


      "Pedro Graca" <hexkid@hotpop. com> wrote in message
      news:c2qkv0$215 ia5$2@ID-203069.news.uni-berlin.de...[color=blue]
      > Ruby Tuesdays wrote:[color=green]
      > > in win32 installation... is it compiled with it or this is a missing
      > > features? Thanks[/color]
      >
      > http://www.php.net/fnmatch
      >
      > <quote>
      > *Warning*
      >
      > For now this function is not available on Windows or other non-POSIX
      > compliant systems.
      > </quote>
      > --
      > --= my mail box only accepts =--
      > --= Content-Type: text/plain =--
      > --= Size below 10001 bytes =--[/color]


      Comment

      • Pedro Graca

        #4
        Re: fnmatch() is not working ...

        [Please do not top post]
        Ruby Tuesdays top-posted (corrected):[color=blue]
        > "Pedro Graca" <hexkid@hotpop. com> wrote in message
        > news:c2qkv0$215 ia5$2@ID-203069.news.uni-berlin.de...[color=green]
        >> Ruby Tuesdays wrote:[color=darkred]
        >> > in win32 installation... is it compiled with it or this is a missing
        >> > features? Thanks[/color]
        >>
        >> http://www.php.net/fnmatch[/color][/color]
        [color=blue]
        > Thanks Pedro, what's the alternative?[/color]

        One of the function on the fnmatch() manual page might do what you want.
        Or, at least, get you started with a solution.

        If you run into problems, post the code you made so far.
        --
        --= my mail box only accepts =--
        --= Content-Type: text/plain =--
        --= Size below 10001 bytes =--

        Comment

        • Ruby Tuesdays

          #5
          Re: fnmatch() is not working ...

          Thanks again Pedro.

          I try to get the example in the manual to work, but no luck. As you said, it
          might not be implemented during the compilation.... BTW: I'm using the Win32
          version.

          Perhaps you know other alternative. Thanks

          "Pedro Graca" <hexkid@hotpop. com> wrote in message
          news:c2qt9t$1v9 cla$1@ID-203069.news.uni-berlin.de...[color=blue]
          > [Please do not top post]
          > Ruby Tuesdays top-posted (corrected):[color=green]
          > > "Pedro Graca" <hexkid@hotpop. com> wrote in message
          > > news:c2qkv0$215 ia5$2@ID-203069.news.uni-berlin.de...[color=darkred]
          > >> Ruby Tuesdays wrote:
          > >> > in win32 installation... is it compiled with it or this is a missing
          > >> > features? Thanks
          > >>
          > >> http://www.php.net/fnmatch[/color][/color]
          >[color=green]
          > > Thanks Pedro, what's the alternative?[/color]
          >
          > One of the function on the fnmatch() manual page might do what you want.
          > Or, at least, get you started with a solution.
          >
          > If you run into problems, post the code you made so far.
          > --
          > --= my mail box only accepts =--
          > --= Content-Type: text/plain =--
          > --= Size below 10001 bytes =--[/color]


          Comment

          • Pedro Graca

            #6
            Re: fnmatch() is not working ...

            [Please do not top post]
            Ruby Tuesdays top-posted again (corrected again):[color=blue]
            > "Pedro Graca" <hexkid@hotpop. com> wrote in message
            > news:c2qt9t$1v9 cla$1@ID-203069.news.uni-berlin.de...[color=green]
            >> [Please do not top post]
            >> Ruby Tuesdays top-posted (corrected):[color=darkred]
            >> > what's the alternative?[/color]
            >>
            >> One of the function on the fnmatch() manual page might do what you want.
            >> Or, at least, get you started with a solution.
            >>
            >> If you run into problems, post the code you made so far.[/color]
            >
            > I try to get the example in the manual to work, but no luck. As you said, it
            > might not be implemented during the compilation.... BTW: I'm using the Win32
            > version.
            >
            > Perhaps you know other alternative. Thanks[/color]

            The manual hints at glob()
            which hints at opendir(), readdir(), closedir()

            What did you try with any of these (or other) functions?[color=blue][color=green]
            >> If you run into problems, post the code you made so far.[/color][/color]


            Please do not top post. It makes threads difficult to follow.
            --
            --= my mail box only accepts =--
            --= Content-Type: text/plain =--
            --= Size below 10001 bytes =--

            Comment

            • Ruby Tuesdays

              #7
              Re: fnmatch() is not working ...

              Hi Pedro, I thought I test it first before I did what you suggested.
              I can't even get this to work... on win32 binaries. Thanks

              <?php
              $color = "gray";
              if (fnmatch("*gr[ae]y", $color)) {
              echo "some form of gray ...";
              }
              ?>


              "Pedro Graca" <hexkid@hotpop. com> wrote in message
              news:c2t5qa$21l g5e$2@ID-203069.news.uni-berlin.de...[color=blue]
              > [Please do not top post]
              > Ruby Tuesdays top-posted again (corrected again):[color=green]
              > > "Pedro Graca" <hexkid@hotpop. com> wrote in message
              > > news:c2qt9t$1v9 cla$1@ID-203069.news.uni-berlin.de...[color=darkred]
              > >> [Please do not top post]
              > >> Ruby Tuesdays top-posted (corrected):
              > >> > what's the alternative?
              > >>
              > >> One of the function on the fnmatch() manual page might do what you[/color][/color][/color]
              want.[color=blue][color=green][color=darkred]
              > >> Or, at least, get you started with a solution.
              > >>
              > >> If you run into problems, post the code you made so far.[/color]
              > >
              > > I try to get the example in the manual to work, but no luck. As you[/color][/color]
              said, it[color=blue][color=green]
              > > might not be implemented during the compilation.... BTW: I'm using the[/color][/color]
              Win32[color=blue][color=green]
              > > version.
              > >
              > > Perhaps you know other alternative. Thanks[/color]
              >
              > The manual hints at glob()
              > which hints at opendir(), readdir(), closedir()
              >
              > What did you try with any of these (or other) functions?[color=green][color=darkred]
              > >> If you run into problems, post the code you made so far.[/color][/color]
              >
              >
              > Please do not top post. It makes threads difficult to follow.
              > --
              > --= my mail box only accepts =--
              > --= Content-Type: text/plain =--
              > --= Size below 10001 bytes =--[/color]


              Comment

              • Pedro Graca

                #8
                Re: fnmatch() is not working ...

                [top-posting]



                [/top-posting]

                Ruby Tuesdays top-posted for the third time
                (corrected for the third time):
                [color=blue]
                > "Pedro Graca" <hexkid@hotpop. com> wrote in message
                > news:c2t5qa$21l g5e$2@ID-203069.news.uni-berlin.de...[color=green]
                >> [Please do not top post]
                >> Ruby Tuesdays top-posted again (corrected again):[color=darkred]
                >> > "Pedro Graca" <hexkid@hotpop. com> wrote in message
                >> > news:c2qt9t$1v9 cla$1@ID-203069.news.uni-berlin.de...
                >> >> [Please do not top post]
                >> >> Ruby Tuesdays top-posted (corrected):
                >> >> > what's the alternative?
                >> >>
                >> >> One of the function on the fnmatch() manual page might do what you
                >> >> want.
                >> >> Or, at least, get you started with a solution.
                >> >>
                >> >> If you run into problems, post the code you made so far.
                >> >
                >> > I try to get the example in the manual to work, but no luck. As you
                >> > said, it might not be implemented during the compilation....
                >> > BTW: I'm using the Win32 version.
                >> >
                >> > Perhaps you know other alternative. Thanks[/color]
                >>
                >> The manual hints at glob()
                >> which hints at opendir(), readdir(), closedir()
                >>
                >> What did you try with any of these (or other) functions?[color=darkred]
                >> >> If you run into problems, post the code you made so far.[/color][/color]
                >
                > Hi Pedro, I thought I test it first before I did what you suggested.
                > I can't even get this to work... on win32 binaries. Thanks
                >
                ><?php
                > $color = "gray";
                > if (fnmatch("*gr[ae]y", $color)) {
                > echo "some form of gray ...";
                > }
                > ?>[/color]

                "Insanity: doing the same thing over and over again and expecting
                different results."
                ~Albert Einstein (1879 - 1955) (attributed)


                Applies to both you and me :(
                --
                --= my mail box only accepts =--
                --= Content-Type: text/plain =--
                --= Size below 10001 bytes =--

                Comment

                • Ruby Tuesdays

                  #9
                  Re: fnmatch() is not working ...


                  "Pedro Graca" <hexkid@hotpop. com> wrote in message
                  news:c3299i$23l 505$1@ID-203069.news.uni-berlin.de...[color=blue]
                  > [top-posting]
                  >
                  > http://www.netmeister.org/news/learn2quote2.html
                  >
                  > [/top-posting]
                  >
                  > Ruby Tuesdays top-posted for the third time
                  > (corrected for the third time):
                  >[color=green]
                  > > "Pedro Graca" <hexkid@hotpop. com> wrote in message
                  > > news:c2t5qa$21l g5e$2@ID-203069.news.uni-berlin.de...[color=darkred]
                  > >> [Please do not top post]
                  > >> Ruby Tuesdays top-posted again (corrected again):
                  > >> > "Pedro Graca" <hexkid@hotpop. com> wrote in message
                  > >> > news:c2qt9t$1v9 cla$1@ID-203069.news.uni-berlin.de...
                  > >> >> [Please do not top post]
                  > >> >> Ruby Tuesdays top-posted (corrected):
                  > >> >> > what's the alternative?
                  > >> >>
                  > >> >> One of the function on the fnmatch() manual page might do what you
                  > >> >> want.
                  > >> >> Or, at least, get you started with a solution.
                  > >> >>
                  > >> >> If you run into problems, post the code you made so far.
                  > >> >
                  > >> > I try to get the example in the manual to work, but no luck. As you
                  > >> > said, it might not be implemented during the compilation....
                  > >> > BTW: I'm using the Win32 version.
                  > >> >
                  > >> > Perhaps you know other alternative. Thanks
                  > >>
                  > >> The manual hints at glob()
                  > >> which hints at opendir(), readdir(), closedir()
                  > >>
                  > >> What did you try with any of these (or other) functions?
                  > >> >> If you run into problems, post the code you made so far.[/color]
                  > >
                  > > Hi Pedro, I thought I test it first before I did what you suggested.
                  > > I can't even get this to work... on win32 binaries. Thanks
                  > >
                  > ><?php
                  > > $color = "gray";
                  > > if (fnmatch("*gr[ae]y", $color)) {
                  > > echo "some form of gray ...";
                  > > }
                  > > ?>[/color]
                  >
                  > "Insanity: doing the same thing over and over again and expecting
                  > different results."
                  > ~Albert Einstein (1879 - 1955) (attributed)
                  >
                  >
                  > Applies to both you and me :(
                  > --
                  > --= my mail box only accepts =--
                  > --= Content-Type: text/plain =--
                  > --= Size below 10001 bytes =--[/color]

                  Sorry Pedro, I somehow do not understand what top post is. Now I do. Thanks.


                  Comment

                  • Pedro Graca

                    #10
                    Re: fnmatch() is not working ...

                    Ruby Tuesdays wrote:[color=blue][color=green]
                    >> Ruby Tuesdays wrote:[color=darkred]
                    >> > I can't even get this to work... on win32 binaries. Thanks
                    >> >
                    >> > <?php
                    >> > $color = "gray";
                    >> > if (fnmatch("*gr[ae]y", $color)) {
                    >> > echo "some form of gray ...";
                    >> > }
                    >> > ?>[/color][/color]
                    >
                    > Sorry Pedro, I somehow do not understand what top post is. Now I do. Thanks.[/color]

                    ok, no harm done :)

                    now ... as the manual ( http://www.php.net/fnmatch ) states the
                    fnmatch() function is not available on Windows.

                    You'll do better to forget about that and use glob() or opendir(),
                    readdir(), ..., closedir().
                    Find pathnames matching a pattern




                    Something like this (not tested):

                    <?php
                    $filelist = glob('*gr?y.txt ');
                    echo '<pre>'; print_r(); echo '</pre>';
                    ?>
                    --
                    USENET would be a better place if everybody read: : mail address :
                    http://www.catb.org/~esr/faqs/smart-questions.html : is valid for :
                    http://www.netmeister.org/news/learn2quote2.html : "text/plain" :
                    http://www.expita.com/nomime.html : to 10K bytes :

                    Comment

                    • R. Rajesh Jeba Anbiah

                      #11
                      Re: fnmatch() is not working ...

                      "Ruby Tuesdays" <NoSpamPlease_r ubytuzdaiz@yaho o.com> wrote in message news:<c330hr$23 6bfm$1@ID-205437.news.uni-berlin.de>...[color=blue]
                      > "Pedro Graca" <hexkid@hotpop. com> wrote in message
                      > news:c3299i$23l 505$1@ID-203069.news.uni-berlin.de...[color=green][color=darkred]
                      > > > Hi Pedro, I thought I test it first before I did what you suggested.
                      > > > I can't even get this to work... on win32 binaries. Thanks
                      > > >
                      > > ><?php
                      > > > $color = "gray";
                      > > > if (fnmatch("*gr[ae]y", $color)) {
                      > > > echo "some form of gray ...";
                      > > > }
                      > > > ?>[/color][/color][/color]

                      Always, the manual and the user notes are your close friends
                      <http://in.php.net/fnmatch>

                      Read the user notes found on the page. It seems to have the
                      workaround for Windows.

                      --
                      "Democracy: Where all citizens are politicians and all politicians
                      are citizens"
                      Email: rrjanbiah-at-Y!com

                      Comment

                      • R. Rajesh Jeba Anbiah

                        #12
                        Re: fnmatch() is not working ...

                        [Top-post fixed. Please don't top-post
                        <http://www.wikipedia.o rg/wiki/Top-post> ]



                        "Ruby Tuesdays" <NoSpamPlease_r ubytuzdaiz@yaho o.com> wrote in message news:<c35qdh$20 gaik$1@ID-205437.news.uni-berlin.de>...[color=blue]
                        > "R. Rajesh Jeba Anbiah" <ng4rrjanbiah@r ediffmail.com> wrote in message
                        > news:abc4d8b8.0 403150233.15a91 e4a@posting.goo gle.com...[color=green][color=darkred]
                        > > > > > Hi Pedro, I thought I test it first before I did what you suggested.
                        > > > > > I can't even get this to work... on win32 binaries. Thanks
                        > > > > >
                        > > > > ><?php
                        > > > > > $color = "gray";
                        > > > > > if (fnmatch("*gr[ae]y", $color)) {
                        > > > > > echo "some form of gray ...";
                        > > > > > }
                        > > > > > ?>[/color]
                        > >
                        > > Always, the manual and the user notes are your close friends
                        > > <http://in.php.net/fnmatch>
                        > >
                        > > Read the user notes found on the page. It seems to have the
                        > > workaround for Windows.
                        > >[/color]
                        > Rajesh,
                        > As Pedro said, the Win32 distribution does not have fnmatch() function
                        > compiled in.
                        >[/color]

                        If I understand right, you didn't look at the manual
                        <http://in.php.net/fnmatch> and didn't read the user notes.

                        _or_ You don't know the meaning of "workaround ":
                        1. http://www.onelook.com/?w=workaround
                        2. http://www.google.com/search?q=define:workaround

                        --
                        http://www.sendmetoindia.com - Send Me to India!
                        Email: rrjanbiah-at-Y!com

                        Comment

                        • Ruby Tuesdays

                          #13
                          Re: fnmatch() is not working ...

                          Rajesh,
                          As Pedro said, the Win32 distribution does not have fnmatch() function
                          compiled in.


                          "R. Rajesh Jeba Anbiah" <ng4rrjanbiah@r ediffmail.com> wrote in message
                          news:abc4d8b8.0 403150233.15a91 e4a@posting.goo gle.com...[color=blue]
                          > "Ruby Tuesdays" <NoSpamPlease_r ubytuzdaiz@yaho o.com> wrote in message[/color]
                          news:<c330hr$23 6bfm$1@ID-205437.news.uni-berlin.de>...[color=blue][color=green]
                          > > "Pedro Graca" <hexkid@hotpop. com> wrote in message
                          > > news:c3299i$23l 505$1@ID-203069.news.uni-berlin.de...[color=darkred]
                          > > > > Hi Pedro, I thought I test it first before I did what you suggested.
                          > > > > I can't even get this to work... on win32 binaries. Thanks
                          > > > >
                          > > > ><?php
                          > > > > $color = "gray";
                          > > > > if (fnmatch("*gr[ae]y", $color)) {
                          > > > > echo "some form of gray ...";
                          > > > > }
                          > > > > ?>[/color][/color]
                          >
                          > Always, the manual and the user notes are your close friends
                          > <http://in.php.net/fnmatch>
                          >
                          > Read the user notes found on the page. It seems to have the
                          > workaround for Windows.
                          >
                          > --
                          > "Democracy: Where all citizens are politicians and all politicians
                          > are citizens"
                          > Email: rrjanbiah-at-Y!com[/color]


                          Comment

                          • Ruby Tuesdays

                            #14
                            Re: fnmatch() is not working ...

                            Hi Rajesh,
                            if you really follow the thread, I did mention that it is not available
                            for Windows. Thanks to Pedro.


                            Comment

                            Working...