#!./perl -w # # Tests to make sure the regexp engine doesn't run into limits too soon. # BEGIN { chdir 't' if -d 't'; @INC = '../lib'; require './test.pl'; } use strict; no warnings 'experimental::regex_sets'; my $email = qr { (?(DEFINE) (?
(?&mailbox) | (?&group)) (? (?&name_addr) | (?&addr_spec)) (? (?&display_name)? (?&angle_addr)) (? (?&CFWS)? < (?&addr_spec) > (?&CFWS)?) (? (?&display_name) : (?:(?&mailbox_list) | (?&CFWS))? ; (?&CFWS)?) (? (?&phrase)) (? (?&mailbox) (?: , (?&mailbox))*) (? (?&local_part) \@ (?&domain)) (? (?&dot_atom) | (?"ed_string)) (? (?&dot_atom) | (?&domain_literal)) (? (?&CFWS)? \[ (?: (?&FWS)? (?&dcontent))* (?&FWS)? \] (?&CFWS)?) (? (?&dtext) | (?"ed_pair)) (? (?&NO_WS_CTL) | (?[ [:ascii:] & [:graph:] & [^][ \\ ] ])) (? (?&ALPHA) | (?&DIGIT) | [-!#\$%&'*+/=?^_`{|}~]) (? (?&CFWS)? (?&atext)+ (?&CFWS)?) (? (?&CFWS)? (?&dot_atom_text) (?&CFWS)?) (? (?&atext)+ (?: \. (?&atext)+)*) (? (?[ [:ascii:] & [^ \000 \n \r ] ])) (? \\ (?&text)) (? (?&NO_WS_CTL) | (?[ [:ascii:] & [:graph:] & [^ " \\ ] ])) (? (?&qtext) | (?"ed_pair)) (? (?&CFWS)? (?&DQUOTE) (?:(?&FWS)? (?&qcontent))* (?&FWS)? (?&DQUOTE) (?&CFWS)?) (? (?&atom) | (?"ed_string)) (? (?&word)+) # Folding white space (? (?: (?&WSP)* (?&CRLF))? (?&WSP)+) (? (?&NO_WS_CTL) | (?[ [:ascii:] & [:graph:] & [^ () ] & [^ \\ ] ])) (? (?&ctext) | (?"ed_pair) | (?&comment)) (? \( (?: (?&FWS)? (?&ccontent))* (?&FWS)? \) ) (? (?: (?&FWS)? (?&comment))* (?: (?:(?&FWS)? (?&comment)) | (?&FWS))) # No whitespace control (? (?[ [:ascii:] & [:cntrl:] & [^ \000 \h \r \n ] ])) (? [A-Za-z]) (? [0-9]) (? \r \n) (? ") (? [ \t]) ) (?&address) }x; run_tests() unless caller; sub run_tests { # rewinding DATA is necessary with PERLIO=stdio when this # test is run from another thread seek *DATA, 0, 0; while () { last if /^__DATA__/ } while () { chomp; next if /^#/; like($_, qr/^$email$/, $_); } done_testing(); } 1; # Because reg_email_thr.t will (indirectly) require this script. # # Acme::MetaSyntactic ++ # __DATA__ Jeff_Tracy@thunderbirds.org "Lady Penelope"@thunderbirds.org "The\ Hood"@thunderbirds.org fred @ flintstones.net barney (rubble) @ flintstones.org bammbamm (bam! bam! (bam! bam! (bam!)) bam!) @ flintstones.org Michelangelo@[127.0.0.1] Donatello @ [127.0.0.1] Raphael (He as well) @ [127.0.0.1] "Leonardo" @ [127.0.0.1] Barbapapa "Barba Mama" Barbalala (lalalalalalalala)