What others have said are roughly correct:
you can't get the fruits of the internal regex compilation step. Perl will give you the stringified version easily, but that's not what you were hoping for.
There's one other issue to beware, if you're trying to persist the stringified version of qr// objects: regex creep.
$regex = qr/(this)is[a]test/i;
$regex = "$regex"; $regex = qr/$regex/; # simulate freeze/thaw cycle
$regex = "$regex"; $regex = qr/$regex/; # simulate freeze/thaw cycle
$regex = "$regex"; $regex = qr/$regex/; # simulate freeze/thaw cycle
print "regex: qr{$regex}\n";
__OUTPUT__
regex: qr{(?-xism:(?-xism:(?-xism:(?i-xsm:(this)is[a]test))))}
The stringifier and the
qr// operator don't bother to collapse all of the redundant or unnecessary buildup of those
(?-xism:...) wrappers. You could get a massive hundred-layer wrapper if you carelessly freeze and thaw these objects.
--
[ e d @ h a l l e y . c c ]
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.