[OpenSIPS-Users] Regular expression matching problem

Muhammad Shahzad shaheryarkh at gmail.com
Mon May 20 18:45:22 CEST 2013


OR to simplify more, you just want to match last four characters as digits,
so you can try this as well,

                if ($rU =~ "[0-9]{4}$") {
                        xlog("L_WARN", ">>>>>>>>>>>>> MATCHED
<<<<<<<<<<<<<< \n");
                } else {
                        xlog("L_WARN", ">>>>>>>>>>>>> NOT MATCHED
<<<<<<<<<<<<<< \n");
                }

Thank you.




On Mon, May 20, 2013 at 6:41 PM, Bogdan-Andrei Iancu <bogdan at opensips.org>wrote:

> **
> Hi Diego,
>
> The REGEXPs in OpenSIPS are POSIX compliant, so \d are not supported. Try:"^(.)?[0-9]{4}$"
> .
>
> Regards,
>
> Bogdan-Andrei Iancu
> OpenSIPS Founder and Developerhttp://www.opensips-solutions.com
>
>
> On 05/20/2013 06:57 PM, Diego Barberio wrote:
>
>   Hi All,
>
>  I'm having a really stupid issue with opensips 1.8.1. I need to do
> different logic if the request line user is a number of 4 digits that can
> be preceded by any character. So I created this regular expression:
> ^(.)?\d{4}$
>  I've tested it on www.regular-expressions.info/javascriptexample.htmland works perfect, however on opensips it never matches.
>
>  I've made the following test script:
>
>
>         if($rU =~ '^(.)?\d{4}$') {
>                 xlog("MATCHES $rU\n");
>         }else{
>                 xlog("NOT MATCHES $rU\n");
>         }
>
>  And I always get "NOT MATCHES":
>
> May 20 11:54:33 localhost /usr/local/sbin/opensips[22628]: NOT MATCHES
> *5522
> May 20 11:54:42 localhost /usr/local/sbin/opensips[22629]: NOT MATCHES
> 5522
>
>  What am I doing wrong?
>
>  Thanks
>  Diego
>
>
> _______________________________________________
> Users mailing listUsers at lists.opensips.orghttp://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
>


-- 
Mit freundlichen Grüßen
Muhammad Shahzad
-----------------------------------
CISCO Rich Media Communication Specialist (CRMCS)
CISCO Certified Network Associate (CCNA)
Cell: +49 176 99 83 10 85
MSN: shari_786pk at hotmail.com
Email: shaheryarkh at googlemail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20130520/a0b73c9d/attachment.htm>


More information about the Users mailing list