in reply to Re: regex compilation
in thread regex compilation
FWIW, single-quoted regex notation gets you closer (update: than double-quoting) to the desired final form, but still not all the way and there are some pitfalls. Better, IMHO, to stick to qr//. (BTW: morgon: It's not necessary to escape a " (double-quote) in a qr// expression.)
File rx_qr_qq_q_1.pl:
Output:use warnings; use strict; my $rx_qr = qr/(?:(?|(?:\")([^\\\"]*(?:\\.[^\\\"]*)*)(?:\")))/; my $rx_qq = qq/(?:(?|(?:\")([^\\\"]*(?:\\.[^\\\"]*)*)(?:\")))/; my $rx__q = q/(?:(?|(?:\")([^\\\"]*(?:\\.[^\\\"]*)*)(?:\")))/; print qq{raw qr: $rx_qr \n}; print qq{qr/qq/: }, qr/$rx_qq/, "\n"; print qq{qr/q/ : }, qr/$rx__q/, "\n";
c:\@Work\Perl\monks\morgon>perl rx_qr_qq_q_1.pl raw qr: (?-xism:(?:(?|(?:\")([^\\\"]*(?:\\.[^\\\"]*)*)(?:\")))) qr/qq/: (?-xism:(?:(?|(?:")([^\"]*(?:\.[^\"]*)*)(?:")))) qr/q/ : (?-xism:(?:(?|(?:\")([^\\"]*(?:\.[^\\"]*)*)(?:\"))))
Give a man a fish: <%-{-{-{-<
|
|---|