in reply to Using previous match in the same matching regexp (now with newlines!)

my ($len,$substring) = ($string =~ /^(\d+) ((??{"(?s).{$1}"}))/s);

See perlre on (?imsx-imsx).

Makeshifts last the longest.

  • Comment on Re: Using previous match in the same matching regexp (now with newlines!)
  • Download Code

Replies are listed 'Best First'.
Re^2: Using previous match in the same matching regexp (now with newlines!)
by cyberconte (Scribe) on Nov 18, 2005 at 16:51 UTC
    Thank you, wise one :-) Not only for the answer, but the reference.