diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2021-09-09 22:12:04 +0300 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2021-09-09 22:12:04 +0300 |
commit | c173297acff1a25bc3483794c7a91026902a79f9 (patch) | |
tree | f5a2a46231f4e5942a596dd2b6cca7967262c7e6 /doc/gawk.texi | |
parent | 8db0967ca4b45ad563d6704ec5a70ad5067db1aa (diff) | |
parent | 1b56dc2b0506573c4cade98611f97597e31ad980 (diff) | |
download | egawk-c173297acff1a25bc3483794c7a91026902a79f9.tar.gz egawk-c173297acff1a25bc3483794c7a91026902a79f9.tar.bz2 egawk-c173297acff1a25bc3483794c7a91026902a79f9.zip |
Merge branch 'gawk-5.1-stable'
Diffstat (limited to 'doc/gawk.texi')
-rw-r--r-- | doc/gawk.texi | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/doc/gawk.texi b/doc/gawk.texi index 90159fdb..6f4bee43 100644 --- a/doc/gawk.texi +++ b/doc/gawk.texi @@ -6101,17 +6101,37 @@ regexp constants are valid and work the way you want them to, using any version of @command{awk}.@footnote{Use two backslashes if you're using a string constant with a regexp operator or function.} -Finally, when @samp{@{} and @samp{@}} appear in regexp constants +When @samp{@{} and @samp{@}} appear in regexp constants in a way that cannot be interpreted as an interval expression (such as @code{/q@{a@}/}), then they stand for themselves. As mentioned, interval expressions were not traditionally available in @command{awk}. In March of 2019, BWK @command{awk} (finally) acquired them. - Nonetheless, because they were not available for so many decades, @command{gawk} continues to not supply them when in compatibility mode (@pxref{Options}). +POSIX says that interval expressions containing repetition counts greater +than 255 produce unspecified results. + +@cindex Eggert, Paul +In the manual for GNU @command{grep}, Paul Eggert notes the following: + +@quotation +Interval expressions may be implemented internally via repetition. +For example, @samp{^(a|bc)@{2,4@}$} might be implemented as +@samp{^(a|bc)(a|bc)((a|bc)(a|bc)?)?$}. A large repetition count may +exhaust memory or greatly slow matching. Even small counts can cause +problems if cascaded; for example, @samp{grep -E +".*@{10,@}@{10,@}@{10,@}@{10,@}@{10,@}"} is likely to overflow a +stack. Fortunately, regular expressions like these are typically +artificial, and cascaded repetitions do not conform to POSIX so cannot +be used in portable programs anyway. +@end quotation + +@noindent +This same caveat applies to @command{gawk}. + @node Bracket Expressions @section Using Bracket Expressions @cindex bracket expressions |