grobber has asked for the wisdom of the Perl Monks concerning the following question:
I have tried to do the code-evaluation bit via the (??..) construct, but something like, say$string =~ /x{<code goes here>}/
returns the dreaded Unescaped left brace in regex is deprecated here warning. I realize that this precise regex can be reworked into$string =~ /(a+)x{(??{length $1})}/
to achieve the intended goal, but the point of the question is whether, nevertheless, there is some procedure that will allow code interpolation between non-literal regex braces.$string =~ /(a+)(??{$1 =~ s/a/x/gr})/
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: interpolating code in regex brace quantifier
by ikegami (Patriarch) on Mar 08, 2019 at 21:42 UTC | |
by grobber (Novice) on Mar 08, 2019 at 23:25 UTC | |
by ikegami (Patriarch) on Mar 09, 2019 at 22:18 UTC | |
|
Re: interpolating code in regex brace quantifier
by AnomalousMonk (Archbishop) on Mar 08, 2019 at 22:31 UTC | |
|
Re: interpolating code in regex brace quantifier
by tybalt89 (Monsignor) on Mar 08, 2019 at 22:10 UTC |