in reply to Regex to match last n characters of a string

Hi,
after using diagnositics I get the following:

(F) You can't quantify a quantifier without intervening parentheses. So things like ** or +* or ?* are illegal. The <-- HERE shows in the regular expression about where the problem was discovered. This should work:

use strict;
use warnings;
use diagnostics;
my $last_41;
my $buffer="a"x50;
($last_41)= $buffer =~ /(.*){41}$/;


Hope this helps some
  • Comment on Re: Regex to match last n characters of a string