lua-users home
lua-l archive

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


On 06/07/2011 06:46 PM, Igor Medeiros wrote:
Excuse me if the question does not belong to this thread, but I'm not
used to the lua patterns. I'm more used to define patterns using regex

I have one more doubt. How do i define a lua pattern that corresponds to
following regular expression?

(systemScreen([1 .. 9])|systemAudio([1 .. 9]))

that is, the text must be of type:

systemScreen(1) or systemScreen(2) or ... or .. systemScreen(9) or
systemAudio(1) or systemAudio(2) or ... or .. systemAudio(9)


Since the patterns have the same syntax as a Lua function call, you could also use 'loadstring' and execute the code in a sandbox with just the functions 'systemScreen' and 'systemAudio'. Assuming there isn't any other text that needs to be ignored.

--
- tom
telliamed@whoopdedo.org