in reply to interpolating code in regex brace quantifier

Sure, you can interpolate there.

my $num_zeds = "13"; /z{$num_zeds}/

But you don't want interpolation. You want something like the following:

/(a+)(??{ 'x{'.length($1).'}' })/

Replies are listed 'Best First'.
Re^2: interpolating code in regex brace quantifier
by grobber (Novice) on Mar 08, 2019 at 23:25 UTC
    This does it, thank you! And yes, I misspoke: it wasn't quite "interpolation" I was after..
      Note that you can also achieve the desired result through recursion
      (a(?1)?x)