[Kamailio-Users] Quick REGEX to match Private IP

Uriel Rozenbaum uriel.rozenbaum at gmail.com
Fri Mar 26 14:46:03 CET 2010


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/users/attachments/20100326/3945adae/attachment.htm>


More information about the Users mailing list