NAME Regexp::Util - A selection of general-utility regexp subroutines SYNOPSIS use Regexp::Util qw( :all ); my $stringified = serialize_regexp( qr/^foo/ ); my $regexp = deserialize_regexp( $stringified ); "foobar" =~ $regexp; DESCRIPTION This module provides the following functions: `is_regexp($ref)` Returns a boolean indicating whether $ref is a regexp reference. Is not tricked by blessed regexps. `regexp_seen_evals($re)` Returns true if $re contains embedded Perl code. `regexp_is_foreign($re)` Returns true if $re uses a regexp engine plugin. (Since Perl 5.10, it has been possible to use regexp engine plugins, such as re::engine::PCRE and re::engine::RE2.) `regexp_is_anchored($re)` Returns true if $re is anchored at the start (e.g. `qr/^foo/`). `serialize_regexp($re)` Serializes the regexp to a string of Perl code. Croaks if the regexp contains embedded Perl code, or uses a regexp engine plugin. `deserialize_regexp($str)` Evaluates a string of Perl code generated by `serialize_regexp` to return the original regexp object. Uses Safe, and also checks that the return value is a regexp, so should be *somewhat* safer than `eval($str)`. BUGS Please report any bugs to . SEE ALSO More regexp stuff: re. Other util modules: Scalar::Util, List::Util. AUTHOR Toby Inkster . COPYRIGHT AND LICENCE This software is copyright (c) 2014 by Toby Inkster. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. DISCLAIMER OF WARRANTIES THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.