[OpenSIPS-Users] regular expression matching question

Callum Guy callum.guy at x-on.co.uk
Tue Jan 2 16:27:43 UTC 2024


Hi Faheem,

This is a simple case of regex support - I believe OpenSIPs uses Extended
Regular Expressions and not Perl Compatible Regular Expressions.

Swap out \d with the longer [0-9] format and your expression should match.

Happy new year,

Callum

On Tue, 2 Jan 2024 at 11:27, Faheem Muhammad <faheem2084 at gmail.com> wrote:

> Hi everyone,
>
> Firstly, I wish you all a Happy New Year with the best wishes for each
> community member and the OpenSIPS project.
>
> I have a question related to regular expressions matching in an IF
> condition.
> There are two identical regular expressions. One RE is matching and one RE
> is not matching the pattern.
>
> *Sample $fU Range:  *+966123456700 to +96612345650
>
> # RE1 - Matching Regular expression
> if($fU =~"\+9661234567[0-4][0-9]|\+966123456750"){
> xlog("re matched\n")
> }
>
> # RE2  - Non matching Regular expression
> if($fU ~="\+9661234567([0-4]\d|50)"){
> } # RE not matched
>
> Can anyone please suggest what I'm doing wrong?
>
> *OpenSIPS version*:     3.2.3
> OS: *Debian 12*
>
>
> Best regards,
> M. Faheem
>
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>

-- 


Take the survey 
<https://docs.google.com/forms/d/e/1FAIpQLScOZTsmt55s-5P1Pf7hTRWHGBF2W-Ly1aWCuEaq2ntSEHBa-Q/viewform>




*0333 332 0000  |  x-on.co.uk <https://www.x-on.co.uk>  |   ** 
<https://www.linkedin.com/company/x-on>   <https://www.facebook.com/XonTel> 
  <https://twitter.com/xonuk> **  |  **Practice Index Reviews 
<https://practiceindex.co.uk/gp/x-on>*

*Our new office address: 22 Riduna 
Park, Melton IP12 1QT.*

X-on
is a trading name of X-on Health Ltd a 
limited company registered in
England and Wales.

Registered Office : Glebe 
Farm, Down Street, Dummer, Basingstoke, Hampshire, England RG25 2AD. 
Company Registration No. 2578478.

The information in this e-mail is 
confidential and for use by the addressee(s)
only. If you are not the 
intended recipient, please notify X-on immediately on +44(0)333 332 0000 
and delete the
message from your computer. If you are not a named addressee 
you must not use,
disclose, disseminate, distribute, copy, print or reply 
to this email. Views
or opinions expressed by an individual
within this 
email may not necessarily
reflect the views of X-on or its associated 
companies. Although X-on routinely
screens for viruses, addressees should 
scan this email and any attachments
for
viruses. X-on makes no 
representation or warranty as to the absence of viruses
in this email or 
any attachments.








-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20240102/b374d7b9/attachment-0001.html>


More information about the Users mailing list