{ no strict 'refs'; local *{'Regexp::TO_JSON'} = sub { "" . shift }; print $json->encode($re), "\n"; }