MatchPattern() problem/bug ?

Report any Hollywood bugs here
Post Reply
User avatar
Tuxedo
Posts: 338
Joined: Sun Feb 14, 2010 12:41 pm

MatchPattern() problem/bug ?

Post by Tuxedo »

Hi Andreas!

I've a problem with MatchPattern() command...
If in the patterns to match was present a"(" or a ")" the command dont works...simply dont recognize the files...eg returns always FALSE
Is that normal or was a bug?

Thank you!
Simone"Tuxedo"Monsignori, Perugia, ITALY.
User avatar
airsoftsoftwair
Posts: 5433
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: MatchPattern() problem/bug ?

Post by airsoftsoftwair »

Got an example? The following works here:

Code: Select all

DebugPrint(MatchPattern("dev:hollywood/test/pic.png", "#?.(iff|bmp|png)"))
It returns 1 as expected and there are parentheses in the pattern.
User avatar
Tuxedo
Posts: 338
Joined: Sun Feb 14, 2010 12:41 pm

Re: MatchPattern() problem/bug ?

Post by Tuxedo »

maybe the problem was if parentheses was in the base pattern?

I cant compare:

moon:ATA/Benkyo 47/Gallery/Gallery (102).jpg

With itself(to look in a table where it is...).
In all the other cases I tryed it works.

dont works also if I try to match only the file name...

Where I'm wong?

Thank you!
Simone"Tuxedo"Monsignori, Perugia, ITALY.
User avatar
airsoftsoftwair
Posts: 5433
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: MatchPattern() problem/bug ?

Post by airsoftsoftwair »

Oh well, what you're trying to do is clearly more than pattern matching is designed to do :) AFAICS, AmigaDOS patterns use parentheses as tokens so you will run into trouble if you try to use them as non-tokens. This is not a Hollywood bug, it's related to the way patterns work in AmigaDOS.
User avatar
Tuxedo
Posts: 338
Joined: Sun Feb 14, 2010 12:41 pm

Re: MatchPattern() problem/bug ?

Post by Tuxedo »

You are right however the file that gives me the problem was a file from a CD...so the original author probably dont care much about AmigaOS tokens and other things...unfortunately...
Simone"Tuxedo"Monsignori, Perugia, ITALY.
User avatar
airsoftsoftwair
Posts: 5433
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: MatchPattern() problem/bug ?

Post by airsoftsoftwair »

Of course you can always write your own pattern matching routines :)
User avatar
Tuxedo
Posts: 338
Joined: Sun Feb 14, 2010 12:41 pm

Re: MatchPattern() problem/bug ?

Post by Tuxedo »

Ok,
I solved the problem changing the MatchPattern line with that:

IF FindStr((fileDIR$ .. file$[j]), FileSelect$) = 0

Now it works perfectly :)
Really simple solution :)
Simone"Tuxedo"Monsignori, Perugia, ITALY.
Post Reply