[Kamailio-Users] Quick REGEX to match Private IP
Alex Balashov
abalashov at evaristesys.com
Fri Mar 26 14:56:26 CET 2010
172.16.0.0/12 does not line up on octet boundaries. You will need to
do something other than a regular expression. Fortunately, 'src_ip'
is a composite that supports comparisons against subnets in shorthand
CIDR notation.
It might also be that whatever you are trying to accomplish can be
done better some other way, but since you did not pose the question in
terms of the objective, I cannot speak to that.
--
Sent from mobile device
On Mar 26, 2010, at 9:46 AM, Uriel Rozenbaum
<uriel.rozenbaum at gmail.com> wrote:
> Hi guys,
>
> Does anyone have a REGEX syntax to match a private IP on the
> 192.168.x.x range?
>
> I'm trying with:
> if($avp(s:ip_origen)=~"192.168(\.([1]?\d{1,2}|2[0-4]{1}\d{1}|25[0-5]
> {1})){2}" )
>
> But all IPs pass as private, even public ones.
>
> Thanks!
> Uriel
> _______________________________________________
> Kamailio (OpenSER) - Users mailing list
> Users at lists.kamailio.org
> http://lists.kamailio.org/cgi-bin/mailman/listinfo/users
> http://lists.openser-project.org/cgi-bin/mailman/listinfo/users
More information about the Users
mailing list