Summary
The current default is line-by-line processing, requiring --at-once for multi-line regex patterns. There is a TODO at line 1639 asking whether --at-once should be the default.
Discussion
Arguments for --at-once as default:
- Multi-line patterns are a common use case (matching across line boundaries)
--dotall is useless without --at-once, which is a confusing interaction
- Modern systems have abundant memory; the "files might be too large" concern is rarely relevant
- Users who want multi-line matching must remember to add
--at-once, which is a common source of confusion
Arguments for keeping line-by-line as default:
- Predictable memory usage for very large files
- Preserves backward compatibility
- Line-by-line is the traditional behavior (matches
sed conventions)
Suggestion
Consider either:
- Making
--at-once the default with a --line-by-line flag for the old behavior
- At minimum, adding a warning when
--dotall is used without --at-once (since the combination is almost certainly a mistake)
Option 2 is lower-risk and addresses the most common confusion.
Summary
The current default is line-by-line processing, requiring
--at-oncefor multi-line regex patterns. There is a TODO at line 1639 asking whether--at-onceshould be the default.Discussion
Arguments for
--at-onceas default:--dotallis useless without--at-once, which is a confusing interaction--at-once, which is a common source of confusionArguments for keeping line-by-line as default:
sedconventions)Suggestion
Consider either:
--at-oncethe default with a--line-by-lineflag for the old behavior--dotallis used without--at-once(since the combination is almost certainly a mistake)Option 2 is lower-risk and addresses the most common confusion.