Hello! May somebody help me how to write regex ^7?(3435)?230\d{3} with LUA pattern? I've tried ^7?3435?230%d%d%d and this is wrong. -- С уважением, Борис Коваленко ЗАО "Тагнет" тел. +7 (3435) 230001 факс +7 (3435) 230005
So you want all these to match? 73435230xxx 7230xxx 3435230xxx 230xxx Just confirming... -MC On Thu, Apr 21, 2011 at 12:01 AM, Boris Kovalenko <boris@tagnet.ru> wrote:
Hello!
May somebody help me how to write regex ^7?(3435)?230\d{3} with LUA pattern? I've tried ^7?3435?230%d%d%d and this is wrong.
-- С уважением, Борис Коваленко ЗАО "Тагнет" тел. +7 (3435) 230001 факс +7 (3435) 230005
_______________________________________________ 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
Hello! After your message I found that and my regex is invalid too :) No, I need: 73435230xxx 3435230xxx 230xxx
So you want all these to match? 73435230xxx 7230xxx 3435230xxx 230xxx
Just confirming... -MC
On Thu, Apr 21, 2011 at 12:01 AM, Boris Kovalenko <boris@tagnet.ru <mailto:boris@tagnet.ru>> wrote:
Hello!
May somebody help me how to write regex ^7?(3435)?230\d{3} with LUA pattern? I've tried ^7?3435?230%d%d%d and this is wrong.
-- С уважением, Борис Коваленко ЗАО "Тагнет" тел. +7 (3435) 230001 факс +7 (3435) 230005
_______________________________________________ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org <mailto: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
_______________________________________________ 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
-- С уважением, Борис Коваленко ЗАО "Тагнет" тел. +7 (3435) 230001 факс +7 (3435) 230005
Try this pattern: "(7?3435)?230%d%d%d -MC On Thu, Apr 21, 2011 at 12:59 AM, Boris Kovalenko <boris@tagnet.ru> wrote:
Hello!
After your message I found that and my regex is invalid too :) No, I need:
73435230xxx 3435230xxx 230xxx
So you want all these to match? 73435230xxx 7230xxx 3435230xxx 230xxx
Just confirming... -MC
On Thu, Apr 21, 2011 at 12:01 AM, Boris Kovalenko <boris@tagnet.ru> wrote:
Hello!
May somebody help me how to write regex ^7?(3435)?230\d{3} with LUA pattern? I've tried ^7?3435?230%d%d%d and this is wrong.
-- С уважением, Борис Коваленко ЗАО "Тагнет" тел. +7 (3435) 230001 факс +7 (3435) 230005
_______________________________________________ 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
_______________________________________________ FreeSWITCH-users mailing listFreeSWITCH-users@lists.freeswitch.orghttp://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-usershttp://www.frees...
-- С уважением, Борис Коваленко ЗАО "Тагнет" тел. +7 (3435) 230001 факс +7 (3435) 230005
_______________________________________________ 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
No success. I use it with string.match function, is it right?
Try this pattern: "(7?3435)?230%d%d%d
-MC
On Thu, Apr 21, 2011 at 12:59 AM, Boris Kovalenko <boris@tagnet.ru <mailto:boris@tagnet.ru>> wrote:
Hello!
After your message I found that and my regex is invalid too :) No, I need:
73435230xxx 3435230xxx 230xxx
So you want all these to match? 73435230xxx 7230xxx 3435230xxx 230xxx
Just confirming... -MC
On Thu, Apr 21, 2011 at 12:01 AM, Boris Kovalenko <boris@tagnet.ru <mailto:boris@tagnet.ru>> wrote:
Hello!
May somebody help me how to write regex ^7?(3435)?230\d{3} with LUA pattern? I've tried ^7?3435?230%d%d%d and this is wrong.
-- С уважением, Борис Коваленко ЗАО "Тагнет" тел. +7 (3435) 230001 факс +7 (3435) 230005
_______________________________________________ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org <mailto: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
_______________________________________________ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org <mailto: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
-- С уважением, Борис Коваленко ЗАО "Тагнет" тел. +7 (3435) 230001 факс +7 (3435) 230005
_______________________________________________ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org <mailto: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
_______________________________________________ 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
-- С уважением, Борис Коваленко ЗАО "Тагнет" тел. +7 (3435) 230001 факс +7 (3435) 230005
On Thu, Apr 21, 2011 at 10:41 AM, Boris Kovalenko <boris@tagnet.ru> wrote:
No success. I use it with string.match function, is it right?
Okay, this is a limitation in Lua's pattern matching. Evidently you cannot use ? on a group like you can in PCRE. So in this case you can use an API call to regex. I wrote a mini test script to demonstrate.
Have fun. :) -MC -- -- pattern.lua -- -- Simple Lua pattern testing api = freeswitch.API(); str_pattern = "(3435)230%d%d%d"; my_str = "73435230111" str_regex = "^(7?3435)?230\\d\\d\\d$"; res = api:execute("regex",my_str .. "|" .. str_regex); stream:write("string: " .. my_str .. ", regex result: " .. res .. "\n"); my_str = "3435230111"; res = api:execute("regex",my_str .. "|" .. str_regex); stream:write("string: " .. my_str .. ", regex result: " .. res .. "\n"); my_str = "230111"; res = api:execute("regex",my_str .. "|" .. str_regex); stream:write("string: " .. my_str .. ", regex result: " .. res .. "\n"); my_str = "987230111"; res = api:execute("regex",my_str .. "|" .. str_regex); stream:write("string: " .. my_str .. ", regex result: " .. res .. "\n"); Output: freeswitch@internal> lua pattern.lua string: 73435230111, regex result: true string: 3435230111, regex result: true string: 230111, regex result: true string: 987230111, regex result: false
Thank You, Michael! Another way is use more specific LUA patterns.
On Thu, Apr 21, 2011 at 10:41 AM, Boris Kovalenko <boris@tagnet.ru <mailto:boris@tagnet.ru>> wrote:
No success. I use it with string.match function, is it right?
Okay, this is a limitation in Lua's pattern matching. Evidently you cannot use ? on a group like you can in PCRE. So in this case you can use an API call to regex. I wrote a mini test script to demonstrate.
Have fun. :) -MC
-- -- pattern.lua -- -- Simple Lua pattern testing api = freeswitch.API(); str_pattern = "(3435)230%d%d%d"; my_str = "73435230111" str_regex = "^(7?3435)?230\\d\\d\\d$"; res = api:execute("regex",my_str .. "|" .. str_regex); stream:write("string: " .. my_str .. ", regex result: " .. res .. "\n"); my_str = "3435230111"; res = api:execute("regex",my_str .. "|" .. str_regex); stream:write("string: " .. my_str .. ", regex result: " .. res .. "\n"); my_str = "230111"; res = api:execute("regex",my_str .. "|" .. str_regex); stream:write("string: " .. my_str .. ", regex result: " .. res .. "\n"); my_str = "987230111"; res = api:execute("regex",my_str .. "|" .. str_regex); stream:write("string: " .. my_str .. ", regex result: " .. res .. "\n"); Output: freeswitch@internal> lua pattern.lua string: 73435230111, regex result: true string: 3435230111, regex result: true string: 230111, regex result: true string: 987230111, regex result: false
_______________________________________________ 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
-- ? ?????????, ????? ????????? ??? "??????" ???. +7 (3435) 230001 ???? +7 (3435) 230005
participants (2)
-
Boris Kovalenko
-
Michael Collins