in reply to Matching n characters with m//g
G'day medium.dave,
Welcome to the Monastery.
The braces are special in regexes. .{32760} matches 32,760 characters; it performs no match on the string containing 32760. See perlre: Quantifiers for more complete details.
What you need to do is escape the braces. Something like this:
$ perl -wE 'my $x = q[X{123}X]; say $x; $x =~ /([{]123[}])/; say $1' X{123}X {123}
Although you haven't shown the complete context of your code, the caret (^) in your regex looks dubious. Perhaps take a step back and read "perlretut - Perl regular expressions tutorial".
— Ken
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Matching n characters with m//g
by medium.dave (Novice) on Feb 22, 2016 at 04:25 UTC | |
by kcott (Archbishop) on Feb 22, 2016 at 06:05 UTC |