in reply to Re: Question on Regular Expression
in thread Question on Regular Expression
If I understand the documentation, you can remove eval from there, as it's useless for qr{}.
Well, as far as I can tell, the code the OP posted doesn't make use of the eval feature at all , the code section is a literal
literal
$ perl -E " $_ = 123; m/\d(?{ warn pos })/" 1 at (re_eval 5) line 1. $ perl -E " no re qw/eval/; $_ = 123; m/\d(?{ warn pos })/" 1 at (re_eval 5) line 1. $ perl -E " $_ = 123; $f = qr/\d(?{ warn pos })/; m/$f/;" 1 at (re_eval 5) line 1. $ perl -E " no re qw/eval/; $_ = 123; $f = qr/\d(?{ warn pos })/; m/$f +/;" 1 at (re_eval 5) line 1.
variable aka "dynamic" aka it throws error :)
$ perl -E " $_ = 123; $f = '(?{ warn pos })'; m/\d$f/; " Eval-group not allowed at runtime, use re 'eval' in regex m/\d(?{ warn + pos })/ at -e line 1. $ perl -E " $_ = 123; $f = '(?{ warn pos })'; $g = qr/\d$f/; m/$g/" Eval-group not allowed at runtime, use re 'eval' in regex m/\d(?{ warn + pos })/ at -e line 1.
I believe whatever the OPs real code, he got this error message so he added the "solution"
I also believe there is no need for any of this stuff :) if all the OP is doing is building a data structure, simply match in a loop and use %+ or use Regexp::Grammars
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Question on Regular Expression
by sjain (Initiate) on Dec 27, 2014 at 14:17 UTC | |
by Anonymous Monk on Dec 28, 2014 at 06:03 UTC | |
by sjain (Initiate) on Dec 28, 2014 at 13:32 UTC | |
by choroba (Cardinal) on Dec 28, 2014 at 14:44 UTC | |
by Anonymous Monk on Dec 28, 2014 at 20:33 UTC |