From: Paul Eggert Date: Mon, 30 Dec 2019 08:22:05 +0000 (-0800) Subject: doc: document trouble with back-references X-Git-Tag: v1.0~4418 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=35cddb5464e1aec6fdd3c89a7e43d4374aab31e6;p=gnulib.git doc: document trouble with back-references * doc/regex.texi (Back-reference Operator): Mention bugs etc. --- diff --git a/ChangeLog b/ChangeLog index 6d7237d172..dccdf7a1a9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2019-12-30 Paul Eggert + + doc: document trouble with back-references + * doc/regex.texi (Back-reference Operator): Mention bugs etc. + 2019-12-29 Paul Eggert doc: use “back-reference” for \1 etc. diff --git a/doc/regex.texi b/doc/regex.texi index 7b83cdd8e1..4e0da9b397 100644 --- a/doc/regex.texi +++ b/doc/regex.texi @@ -1144,6 +1144,18 @@ example, @samp{(a(b))\2*} matches @samp{a} followed by two or more If there is no preceding @w{@var{digit}-th} subexpression, the regular expression is invalid. +Back-references can greatly slow down matching, as they can generate +exponentially many matching possibilities that can consume both time +and memory to explore. Also, the POSIX specification for +back-references is at times unclear. Furthermore, many regular +expression implementations have back-reference bugs that can cause +programs to return incorrect answers or even crash, and fixing these +bugs has often been low-priority---for example, as of 2019 the GNU C +library bug database contained back-reference bugs 52, 10844, 11053, +and 23522, with little sign of forthcoming fixes. Luckily, +back-references are rarely useful and it should be little trouble to +avoid them in practical applications. + @node Anchoring Operators @section Anchoring Operators