[REBOL] Re: How to parse a filename using wildcards
From: ale870::gmail at: 17-Jul-2007 8:53
Great! It works!
Final draft code (to filter a directory), is the following:
foreach i read %/f/mydocs/rebol/. [
f1: (find/match/any i "view*.htm*")
if f1 <> none [
if tail? f1 [
print i
];if
];if
];foreach
Have you any suggestion how to optimize, but maintaining the code readable?
Thank you!
On 7/17/07, Gabriele Santilli <santilli.gabriele-gmail.com> wrote:
>
> 2007/7/17, Alessandro Manotti <ale870-gmail.com>:
>
> > I tried to use FIND/MATCH/ANY, but I found a... bug (?).
>
> Not a bug - FIND returns the end of the match. You can use TAIL? to
> check if the whole string matched.
>
> >> find/match/any "something" "some*g"
> == ""
> >> find/match/any "somethingelse" "some*g"
> == "else"
> >> tail? find/match/any "something" "some*g"
> == true
> >> tail? find/match/any "somethingelse" "some*g"
> == false
>
> HTH,
> Gabriele.
> --
> To unsubscribe from the list, just send an email to
> lists at rebol.com with unsubscribe as the subject.
>
--
--Alessandro