Next Regular Expression Mastery 67

Perl 6

        rule octet { \d <1,3> }
        rule ip_address { <octet> [ \. <octet> ]<3> }
        $ip_address = /\d<1,3>[\.\d<1,3>]<3>/;
        $ip_address = m:p5/\d{1,3}(?:\.\d{1,3}){3}/;


Next Copyright © 2002 M. J. Dominus