public
anonymous / gist:4362742
Created

Validating ranges in regexp

  • Download Gist
gistfile1.pl
Perl
1 2 3 4
$_ = "Go 127.666.0.1, I said! He went to 173.194.32.32.";
say .Str for m:g/ ( (\d ** 1..3) <?{ 0 < $0 < 255 }> ) ** 4 % "." /;
 
# should print only 173.194.32.32

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.