Skip Menu |

This queue is for tickets about the Regexp-Common CPAN distribution.

Report information
The Basics
Id: 120456
Status: rejected
Priority: 0/
Queue: Regexp-Common

People
Owner: Nobody in particular
Requestors: DDUMONT [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 2016060801
Fixed in: (no value)



Subject: Perl comment RE confused by '#' embedded in strings
Hello The to_eol sub in Regexp::Common::comment is confused when a string embeds the comment caracter. See for instance: $ cat test.pl use Regexp::Common qw/comment/; use 5.10.1; say $RE{comment}{Perl}->subs("foo('#') # foo\n" => "# bar"); $ perl test.pl foo('# bar I would expect the script to output foo('#') # bar All the best
This is not a bug. $RE{comment}{Perl} is a pattern which matches a Perl comment -- that is, it starts at a '#' and matches up to the first new line. And that's it. Nothing else. In particular, it does not include a full Perl parser. In the given string: foo('#') # foo\n the pattern matches "#') # foo\n", as that's a substring which starts with a #, and ends with the first newline following it. Regards, Abigail
Le Mer 01 Mar 2017 21:38:28, ABIGAIL a écrit : Show quoted text
> This is not a bug.
ok. You may want to mention this limitation in the documentation if only to avoid similar bug reports in the future. All the best