作者: 藤岡和夫
日時: 2007/6/02(09:52)
On Fri, 01 Jun 2007 23:58:27 +0900
"Bruce." <kbk@...> さんwrote:

> あー、それは正規表現の中身が固定文字列だからですよ >エラーにならない。
> /$pattern/ のように、変数のinterpolationがないとひっかかりません。
> 今回も外の環境から取り込んできたデータの話なんで、固定文字列での
> チェックはあまり意味がないっす。
> 
> When "use re 'eval'" is in effect, a regex is allowed to contain "(?{... })"
> zero-width assertions even if regular expression contains variable
> interpolation. That is normally disallowed, since it is a potential security
> risk. Note that this pragma is ignored when the regular expression is
> obtained from tainted data, i.e. evaluation is always disallowed with
> tainted regular expressions. See "(?{ code })" in perlre.
> 

 なるほど、

$pat = "(?{print \"Hello!\n\";})";

と変数にして実行するとエラーになりました。ようやく得心しました。使ってい
る環境が複雑になっているので、何か他にミスをしていないかと心配だったもの
で。ありがとうございました。

藤岡 和夫
kazuf@...
日曜プログラマのひとりごと http://homepage1.nifty.com/kazuf/renewal.html