mirror of https://github.com/golang/go.git
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> |
||
|---|---|---|
| .. | ||
| syntax | ||
| testdata | ||
| all_test.go | ||
| backtrack.go | ||
| example_test.go | ||
| exec.go | ||
| exec2_test.go | ||
| exec_test.go | ||
| find_test.go | ||
| onepass.go | ||
| onepass_test.go | ||
| regexp.go | ||