.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Regexp::Stringify 3pm" .TH Regexp::Stringify 3pm "2021-01-06" "perl v5.32.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Regexp::Stringify \- Stringify a Regexp object .SH "VERSION" .IX Header "VERSION" This document describes version 0.06 of Regexp::Stringify (from Perl distribution Regexp-Stringify), released on 2016\-10\-29. .SH "SYNOPSIS" .IX Header "SYNOPSIS" Assuming this runs on Perl 5.14 or newer. .PP .Vb 5 \& use Regexp::Stringify qw(stringify_regexp); \& $str = stringify_regexp(regexp=>qr/a/i); # \*(Aq(^i:a)\*(Aq \& $str = stringify_regexp(regexp=>qr/a/i, with_qr=>1); # \*(Aqqr(a)i\*(Aq \& $str = stringify_regexp(regexp=>qr/a/i, plver=>5.010); # \*(Aq(?:(?i\-)a)\*(Aq \& $str = stringify_regexp(regexp=>qr/a/ui, plver=>5.010); # \*(Aq(?:(?i\-)a)\*(Aq .Ve .SH "FUNCTIONS" .IX Header "FUNCTIONS" .SS "stringify_regexp(%args) \-> str" .IX Subsection "stringify_regexp(%args) -> str" Stringify a Regexp object. .PP This routine is an alternative to Perl's default stringification of Regexp object (i.e.:\f(CW"$re"\fR) and has some features/options, e.g.: producing regexp string that is compatible with certain perl versions. .PP If given a string (or other non-Regexp object), will return it as-is. .PP This function is not exported by default, but exportable. .PP Arguments ('*' denotes required arguments): .IP "\(bu" 4 \&\fBplver\fR => \fIstr\fR .Sp Target perl version. .Sp Try to produce a regexp object compatible with a certain perl version (should at least be >= 5.10). .Sp For example, in perl 5.14 regex stringification changes, e.g. \f(CW\*(C`qr/hlagh/i\*(C'\fR would previously be stringified as \f(CW\*(C`(?i\-xsm:hlagh)\*(C'\fR, but now it's stringified as \&\f(CW\*(C`(?^i:hlagh)\*(C'\fR. If you set \f(CW\*(C`plver\*(C'\fR to 5.10 or 5.12, then this routine will still produce the former. It will also ignore regexp modifiers that are introduced in newer perls. .Sp Note that not all regexp objects are translatable to older perls, e.g. if they contain constructs not known to older perls like \f(CW\*(C`(?^...)\*(C'\fR before perl 5.14. .IP "\(bu" 4 \&\fBregexp\fR* => \fIre\fR .IP "\(bu" 4 \&\fBwith_qr\fR => \fIbool\fR .Sp If you set this to 1, then \f(CW\*(C`qr/a/i\*(C'\fR will be stringified as \f(CW\*(Aqqr/a/i\*(Aq\fR instead as \&\f(CW\*(Aq(?^i:a)\*(Aq\fR. The resulting string can then be eval-ed to recreate the Regexp object. .PP Return value: (str) .SH "HOMEPAGE" .IX Header "HOMEPAGE" Please visit the project's homepage at . .SH "SOURCE" .IX Header "SOURCE" Source repository is at . .SH "BUGS" .IX Header "BUGS" Please report any bugs or feature requests on the bugtracker website .PP When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature. .SH "AUTHOR" .IX Header "AUTHOR" perlancar .SH "COPYRIGHT AND LICENSE" .IX Header "COPYRIGHT AND LICENSE" This software is copyright (c) 2016 by perlancar@cpan.org. .PP This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.