#!perl use strict; use warnings; use Perl6::Say; my $PRIV_IP_RE = qr{^https?:// \b(?: 10\.(?:\d\d?|1\d\d|2(?:[0-4]\d|5[0-5]))| # class A 172\.(?:1[6-9]|2\d|3[01])| # class B 192\.168 # class C ) \.(?:\d\d?|1\d\d|2(?:[0-4]\d|5[0-5])) \.(?:\d\d?|1\d\d|2(?:[0-4]\d|5[0-5]))\b }xi; for my $url (qw(http://10.10.2.60/ http://www.google.com/)) { say "$url IS " . ($url =~ $PRIV_IP_RE ? "NOT BOOKMARKABLE" :
![正規表現で、ソーシャルブックマーカブルな URL かそうでないかを判定する : にぽたん研究所](https://cdn-ak-scissors.b.st-hatena.com/image/square/da78a05937633f7a2b4b2219826151c370cd607b/height=288;version=1;width=512/https%3A%2F%2Fparts.blog.livedoor.jp%2Fimg%2Fusr%2Fcmn%2Fogp_image%2Flivedoor.png)