Posts: 1,058
Threads: 367
Joined: Oct 2007
I wonder whether it is possible to use in a foreach statement a regular expression in "coll", for example to enumerate files.
I understand I can enumerate files using a regular expression in GetFilesInFolder.
Any advice is much appreciated.
Posts: 12,071
Threads: 140
Joined: Dec 2002
Function
FE_RegexExample
;/
function str&match $regex $string_ [submatch]
int i k
i=findrx(string_ regex i 0 k submatch)
if(i<0) ret
match.get(string_ i k)
i+k
ret 1
Macro
Macro2871
str s="qwe 123 rty 45 uio 6"
str match
foreach match "\d+" FE_RegexExample s
,out match
With files better use standard code with FE_Dir, and use findrx in the loop. Regular expression inside a foreach-function like FE_Dir would not make faster.
Posts: 1,058
Threads: 367
Joined: Oct 2007
Many thanks indeed, it is very constructive.