[REBOL] Re: Matching RE's - pattern matching
From: arolls:bigpond:au at: 23-Mar-2001 18:15
This is what I use in my 'ls function found here:
This matches filenames in a directory list:
foreach file list [
match: find/any/match file :pattern
if match [
if (index? tail file) = (index? match) [
; this is where you can say it actually matches
if error? try [
append either dir? file [dir-list] [file-list] file
'pattern is a string such as "r*.r"
In my quick testing the /case refinement works
with this too - eg.
>> file: to-string %Rtest.blah
>> match: find/case/any/match file "R*.*"
>> (index? tail file) = (index? match)