go/src/regexp
Russ Cox 98c9f271d6 regexp/syntax: use more compact Regexp.String output
Compact the Regexp.String output. It was only ever intended for debugging,
but there are at least some uses in the wild where regexps are built up
using regexp/syntax and then formatted using the String method.
Compact the output to help that use case. Specifically:

 - Compact 2-element character class ranges: [a-b] -> [ab].
 - Aggregate flags: (?i:A)(?i:B)*(?i:C)|(?i:D)?(?i:E) -> (?i:AB*C|D?E).

Fixes #57950.

Change-Id: I1161d0e3aa6c3ae5a302677032bb7cd55caae5fb
Reviewed-on: https://go-review.googlesource.com/c/go/+/507015
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
Auto-Submit: Russ Cox <rsc@golang.org>
2023-08-16 16:02:30 +00:00
..
syntax regexp/syntax: use more compact Regexp.String output 2023-08-16 16:02:30 +00:00
testdata all: fix typos 2023-07-18 19:55:29 +00:00
all_test.go regexp: add Regexp.TextMarshaler/TextUnmarshaler 2023-04-12 20:03:09 +00:00
backtrack.go
example_test.go regexp: improve Regexp.ReplaceAll documentation and tests related to Expand part 2023-08-07 00:22:53 +00:00
exec.go
exec2_test.go
exec_test.go
find_test.go
onepass.go all: add missing periods in comments 2022-11-18 17:59:44 +00:00
onepass_test.go
regexp.go regexp: improve Regexp.ReplaceAll documentation and tests related to Expand part 2023-08-07 00:22:53 +00:00