hi guys, it possible to match *999*11# in regular expression in freeswitch ? in the wiki the above example don't exis, plz help thanks
Just put a \ before each * and maybe the # as well and you should be good to go. Samira Mh <saami_mh@ymail.com> wrote:
hi guys, it possible to match *999*11# in regular expression in freeswitch ? in the wiki the above example don't exis, plz help thanks ---------------------------------------------------- Alternatives:
---------------------------------------------------- _________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
Join Us At ClueCon - Aug 7-9, 2012
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
-- Your life is like a penny. You're going to lose it. The question is: How do you spend it? John Covici covici@ccs.covici.com
thanks so much for your reply,nut i think the below patter is true as well, ^([*]999[*]11[#])$ is that true? ________________________________ From: "covici@ccs.covici.com" <covici@ccs.covici.com> To: FreeSWITCH Users Help <freeswitch-users@lists.freeswitch.org> Sent: Saturday, June 2, 2012 2:18 PM Subject: Re: [Freeswitch-users] regular expression ? Just put a \ before each * and maybe the # as well and you should be good to go. Samira Mh <saami_mh@ymail.com> wrote:
hi guys, it possible to match *999*11# in regular expression in freeswitch ? in the wiki the above example don't exis, plz help thanks ---------------------------------------------------- Alternatives:
---------------------------------------------------- _________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
Join Us At ClueCon - Aug 7-9, 2012
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
-- Your life is like a penny. You're going to lose it. The question is: How do you spend it? John Covici covici@ccs.covici.com _________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com Join Us At ClueCon - Aug 7-9, 2012 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
If you are trying to match the dialed digits "*999*11#" then yes, the pattern you suggested below is not appropriate. Just putting special characters inside of [ and ] is not enough to change their meaning. The proper way to handle this is by doing what Covici suggested and use a \ (backslash) in front of the * characters. (The # char is not one of the special characters in PCRE, therefore it does not need a backslash.) The best pattern for your example is: ^(\*999\*11#)$ That would match "*999*11#" and absolutely nothing else. If you need to be flexible on the digits that you match you could do something like this: ^(\*\d\d\d\*\d\d#)$ That would match * plus 3 digits plus * plus 2 digits. Example matches: *123*45# *876*99# *333*33# You could even grab the internal digit sequences and put them into $2 and $3: ^(\*(\d\d\d)\*(\d\d)#)$ Notice what the special vars contain by using this little table: Dialed: $1: $2: $3: *123*45# *123*45# 123 45 *876*99# *876*99# 876 99 *333*33# *333*33# 333 33 I strongly recommend that you try it out. Put this in your dialplan and try it out: <extension name="tinkering with regexes"> <condition field="destination_number" expression="^(\*(\d\d\d)\*(\d\d)#)$"> <action application="log" data="INFO \$1 is $1"/> <action application="log" data="INFO \$2 is $2"/> <action application="log" data="INFO \$3 is $3"/> </condition> </extension> Try it out - make a bunch of calls and see what happens. Change the regex around and try dialing again. I promise you that once you start writing your own regexes - and occasionally breaking them in the process - you will learn them and use them to your advantage. -MC On Sat, Jun 2, 2012 at 3:11 AM, Samira Mh <saami_mh@ymail.com> wrote:
thanks so much for your reply,nut i think the below patter is true as well, ^([*]999[*]11[#])$ is that true?
------------------------------ *From:* "covici@ccs.covici.com" <covici@ccs.covici.com> *To:* FreeSWITCH Users Help <freeswitch-users@lists.freeswitch.org> *Sent:* Saturday, June 2, 2012 2:18 PM *Subject:* Re: [Freeswitch-users] regular expression ?
Just put a \ before each * and maybe the # as well and you should be good to go.
Samira Mh <saami_mh@ymail.com> wrote:
hi guys, it possible to match *999*11# in regular expression in freeswitch ? in the wiki the above example don't exis, plz help thanks ---------------------------------------------------- Alternatives:
On Sat, 2 Jun 2012 02:02:21 -0700 (PDT) Samira Mh <saami_mh@ymail.com> wrote:
it possible to match *999*11# in regular expression in freeswitch ? in the wiki the above example don't exis,
You definitely should have a look at: http://www.regular-expressions.info/ You could also use: http://www.quanetic.com/Regex but _please_ read carefully the first one 'cos it will allow you to build your own expressions without any help, so use this one _only_ to validate the result of your own work:) [NB: There are plenty of other sites like this one]. My ¢1+¢1 JY -- I can't think about that. It doesn't go with HEDGES in the shape of LITTLE LULU -- or ROBOTS making BRICKS ...
participants (4)
-
Bzzz
-
covici@ccs.covici.com
-
Michael Collins
-
Samira Mh