++ed by:
MIXAS TOBYINK PERLANCAR

3 PAUSE users
2 non-PAUSE users.

Toby Inkster

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.)

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).

This module can also re-export regexp_pattern($re), regmust($re), regname($name, $all), regnames($all), and regnames_count() from re for convenience.

BUGS

Please report any bugs to http://rt.cpan.org/Dist/Display.html?Queue=Regexp-Util.

SEE ALSO

More regexp stuff: re.

Other util modules: Scalar::Util, List::Util, Hash::Util.

AUTHOR

Toby Inkster <tobyink@cpan.org>.

COPYRIGHT AND LICENCE

This software is copyright (c) 2014, 2018 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.