Just a note on the use of backshashes in Perl strings. Consider the following, which uses 3 ways to represent the string with which $text1 is initialised:

#! perl use strict; use warnings; my %patterns = ( original_text => "\<\?php\ \@error_reporting\(0\)\;\ if\ \(\!isset +\(\$eva1fYlbakBcVSir\)\)\ \{\$eva1fYlbakBcVSir\ \=\ \"7kyJ", double_quoted => "<?php \@error_reporting(0); if (!isset(\$eva1fYl +bakBcVSir)) {\$eva1fYlbakBcVSir = \"7kyJ", single_quoted => '<?php @error_reporting(0); if (!isset($eva1fYlba +kBcVSir)) {$eva1fYlbakBcVSir = "7kyJ', ); for (qw[original_text double_quoted single_quoted]) { my $text = $patterns{$_}; my $re = qr[^\Q$text\E]; print "\n", $_, ': ', "\n", $text, " -->\n", $re, "\n"; }

The output shows that the strings are identical, as are the corresponding regular expressions. See Quote and Quote like Operators, which says:

Apart from the behavior described above, Perl does not expand multiple levels of interpolation. In particular, contrary to the expectations of shell programmers, back-quotes do NOT interpolate within double quotes, nor do single quotes impede evaluation of variables when used within double quotes.

All of this may or may not help with the stated problem. But it will certainly help in writing clearer and more readable code.

Athanasius <°(((><contra mundum Iustus alius egestas vitae, eros Piratica,


In reply to Re: Searching and replacing quoted regex strings by Athanasius
in thread Searching and replacing quoted regex strings by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.