MatchPattern() problem/bug ?

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

MatchPattern() problem/bug ?

Post by Tuxedo » Wed Feb 24, 2010 1:24 am

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: 3355
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: MatchPattern() problem/bug ?

Post by airsoftsoftwair » Thu Feb 25, 2010 12:01 pm

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: 225
Joined: Sun Feb 14, 2010 12:41 pm

Re: MatchPattern() problem/bug ?

Post by Tuxedo » Thu Feb 25, 2010 2:16 pm

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: 3355
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: MatchPattern() problem/bug ?

Post by airsoftsoftwair » Fri Feb 26, 2010 10:35 pm

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: 225
Joined: Sun Feb 14, 2010 12:41 pm

Re: MatchPattern() problem/bug ?

Post by Tuxedo » Sat Feb 27, 2010 4:09 pm

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: 3355
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: MatchPattern() problem/bug ?

Post by airsoftsoftwair » Sat Feb 27, 2010 11:40 pm

Of course you can always write your own pattern matching routines :)

User avatar
Tuxedo
Posts: 225
Joined: Sun Feb 14, 2010 12:41 pm

Re: MatchPattern() problem/bug ?

Post by Tuxedo » Wed Mar 03, 2010 11:40 pm

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