lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hello!

My question may sound strange but it is very important for me.

Configuration that I use for my program essentially is very simple

if(var1 == "string1") then
   if(match("some_pattern", var2)) then return 1 end
   if(match("some_pattern1", var2)) then return 2 end
   if(match("some_pattern1", var2)) then return 3 end
end

...

BUT. I have to check ALL patterns before the execution starts. In other words
I want to reject configuration file if there is some error in one of the
RE patterns. Ideally there would be some hook that gets called when "match" 
and all parameters for it are identified, giving chance to check which
parameters would be passed at run-time.

I was thinking about additional passing  thru regular expression to find all
'match' and then compiling all regular expression found, but decided to ask
first if there is some "cleaner" solution already :)

Andrei