Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
foreach and regular expression
#2
Function FE_RegexExample
Code:
Copy      Help
;/
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
Code:
Copy      Help
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.


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)