Page 1 of 1
MatchPattern() problem/bug ?
Posted: Wed Feb 24, 2010 1:24 am
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!
Re: MatchPattern() problem/bug ?
Posted: Thu Feb 25, 2010 12:01 pm
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.
Re: MatchPattern() problem/bug ?
Posted: Thu Feb 25, 2010 2:16 pm
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!
Re: MatchPattern() problem/bug ?
Posted: Fri Feb 26, 2010 10:35 pm
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.
Re: MatchPattern() problem/bug ?
Posted: Sat Feb 27, 2010 4:09 pm
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...
Re: MatchPattern() problem/bug ?
Posted: Sat Feb 27, 2010 11:40 pm
by airsoftsoftwair
Of course you can always write your own pattern matching routines

Re: MatchPattern() problem/bug ?
Posted: Wed Mar 03, 2010 11:40 pm
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
