I don't believe there is a way to pull multiple values back from the call to api:execute. However, Lua has native pattern matching with captures. Here are a few resources for you: FreeSWITCH book, pages 149-151 http://www.lua.org/pil/20.3.html http://www.lua.org/manual/5.1/manual.html#5.4.1 Here's a simple example that you can actually run with "luarun" if you want to do some testing: -- pattern.lua data = "1234#5678"; _,_,var1,var2 = string.find(data,"(%d+)#(%d+)"); freeswitch.consoleLog("INFO","\ndata: " .. data .. "\nvar1: " .. var1 .. "\nvar2: " .. var2 .. "\n"); Output: freeswitch@internal> luarun pattern.lua +OK 2011-04-18 08:28:49.242080 [INFO] switch_cpp.cpp:1197 data: 1234#5678 var1: 1234 var2: 5678 Have fun! -MC P.S. - I added some of this information to the wiki: http://wiki.freeswitch.org/wiki/Mod_lua#Native_Lua_Pattern_Matching On Mon, Apr 18, 2011 at 6:06 AM, Boris Kovalenko <boris@tagnet.ru> wrote:
Hello!
How can I use regexp with LUA scripts? Yes, I found I may use api:execute('regex'....) but can't understand how to get matched strings from it. For example my re is (\d+)#(\d+) and I want to get $1 and $2 in some variables.
-- Regards, Boris
_______________________________________________ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org