Subject: bug#11216: 23.4; parenthesis matching breaks on certain complex expressions

From: Nathan Trapuzzano <[email-masked]>
Date: Tue, 10 Apr 2012 20:18:47 -0400

Here's a complex regular expression that breaks parenthesis matching
(and yes, that's a real regular expression generated from a real perl
program).

Matching gets messed up with the open parenthesis immediately following
the first (?<!S\d). I suspect this is due to the opening double-quote
about 10 characters later.

I noticed that the behavior of show-paren-mode changes depending on the
major mode. For example, the behavior described above happens in
fundamental mode, whereas when I switch to text mode, quotation marks
are ignored. However, switching to text mode also causes paren-matching
to ignore back-slashes and thus escaped parentheses/brackets. I think
the best fix would be to enable customization of show-paren-mode so
that the user can specify which characters should be ignored when
matching parentheses.

I've also attached a file containing the regexp in question in case the long line gets broken up over mail transmission.