is($str, '(?:\\w(?:\\w*?x|y)|\\d(?:\\d*d|e))', 'unroll plus \\d and \\w'); // //PHPではUTF-8以外のマルチバイトは扱えません。 // $u->add( '\\xab+f', '\\xabg', '\\xcd+?h', '\\xcdi'); // $str = $u->as_string(); // is( $str, "(?:\xcd(?:\xcd*?h|i)|\xab(?:\xab*f|g))", 'unroll plus meta x' ); $u->add('[a-e]+h', '[a-e]i', '[f-j]+?k', '[f-j]m'); $str = $u->as_string(); is($str, "(?:[f-j](?:[f-j]*?k|m)|[a-e](?:[a-e]*h|i))", 'unroll plus class'); $u->add("a+b"); $str = $u->as_string(); is($str, "a+b", 'reroll a+b'); $u->add("a+b", "a+"); $str = $u->as_string(); is($str, "a+b?", 'reroll a+b?'); $u->add("a+?b", "a+?"); $str = $u->as_string(); is($str, "a+?b?", 'reroll a+?b?'); $u->unroll_plus(0)->add('1+2', '13'); $str = $u->as_string(); is($str, "(?:1+2|13)", 'no unrolling'); $u->unroll_plus()->add('1+2', '13'); $str = $u->as_string(); is($str, "1(?:1*2|3)", 'unrolling again via implicit'); $u->add('d+ldrt', 'd+ndrt', 'd+ldt', 'd+ndt', 'd+x'); $str = $u->as_string(); is($str, 'd+(?:[ln]dr?t|x)', 'visit ARRAY codepath'); /* is( $_, 'eq', $fixed, '$_ has not been altered' ); */ echo "===OK===\n";