Skip to content

Consider making --at-once the default processing mode #46

Description

@jlevy

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:

  1. Making --at-once the default with a --line-by-line flag for the old behavior
  2. 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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions